Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanUpChildZombies ¶
func CleanUpChildZombies()
This is a utility function to clean up zombie subprocesses that can get left behind by RestartOnChange, due to the fashion in which it restarts the process. This will synchronously execute `pgrep` to get a list of child process IDs, and then asychronously call syscall.Wait4 on each one to remove zombies. In addition, if those processes are not yet terminated, this calls SIGHUP, SIGINT, and finally SIGTERM over the course of a few minutes in order to encourage them to die.
func CleanUpChildZombiesQuietly ¶
func CleanUpChildZombiesQuietly()
This is identical to CleanUpChildZombies except that it outputs nothing to stderr.
func NotifyOnChange ¶
Subscribe to a notification when the current process' executable file is modified. Returns a channel to which notifications (just `true`) will be sent whenever a change is detected.
func NotifyOnSighup ¶
func NotifyOnSigterm ¶
func RestartOnChange ¶
func RestartOnChange()
Restart the current program when the program's executable is updated. This function is a wrapper around NotifyOnChange and RestartViaExec, calling the latter when the former signals that a change was detected.
func RestartViaExec ¶
func RestartViaExec()
Restart the current process by calling syscall.Exec, using os.Args (with filepath.LookPath) and os.Environ() to recreate the same args & environment that was used when the process was originally started. Due to using syscall.Exec, this function is not portable to systems that don't support exec.
Types ¶
This section is empty.