Documentation ¶
Overview ¶
Helper code for starting a daemon process.
This package assumes that the user invokes a tool, which invokes a daemon process. Though the tool starts the daemon process with stdin, stdout, and stderr closed (using Run), the daemon should be able to communicate status to the user while it starts up (using StatusWriter), causing the tool to exit in success or failure only when it is clear whether the daemon has sucessfully started (which it signal using SignalOutcome).
Index ¶
Constants ¶
This section is empty.
Variables ¶
var StatusWriter io.Writer
For use by the daemon: the writer that should be used for logging status messages while in the process of starting up. The writer must not be written to after calling SignalOutcome.
Set to a reasonable default if the process wasn't invoked by a call to Run.
Functions ¶
func Run ¶
Invoke the daemon with the supplied arguments, waiting until it successfully starts up or reports that is has failed. Write status updates while starting into the supplied writer (which may be nil for silence). Return nil only if it starts successfully.
func SignalOutcome ¶
For use by the daemon: signal an outcome back to Run in the invoking tool, causing it to return. Do nothing if the process wasn't invoked with Run.
Types ¶
This section is empty.