# We're in emergency mode: do not crash the kernel, spawn a shell and exit
logger.fatal("NimD has entered emergency mode and cannot continue. You will be now (hopefully) dropped in a root shell: you're on your own. May the force be with you")
discardexecShellCmd("/bin/sh")# TODO: Is this fine? maybe use execProcess
else:
logger.info("Terminating child processes with SIGINT")
# TODO
logger.info("Terminating child processes with SIGKILL")
# TODO
logger.warning("Shutdown procedure complete, sending final termination signal")
# TODO
quit(code)
proc setHostname*(logger:Logger):string=
## Sets the machine's hostname. Returns
## the hostname that has been set or an
## empty string if an error occurs. If
## /etc/hostname doesn't exist, the hostname
## defaults to localhost
varhostname:string
try:
ifnotfileExists("/etc/hostname"):
logger.warning("/etc/hostname doesn't exist, defaulting to 'localhost'")