Documentation
¶
Overview ¶
Package interrupt runs registered cleanup when ddev receives Ctrl-C, SIGTERM, or SIGHUP, so that an interrupted command does not leave temporary containers or a raw-mode terminal behind.
Code that handles some of these signals itself calls Delegate() while it does, and the handler then runs the cleanup for those without exiting.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Delegate ¶
Delegate tells the handler that the caller handles sigs itself, so for those the handler runs the cleanup but leaves exiting to the caller. Call the returned release function when the caller stops handling them.
func OnInterrupt ¶
OnInterrupt registers f to run on every interrupt until unregister is called. f runs more than once when a caller has delegated, and should give up when ctx is done.
func Run ¶
Run calls each cleanup function in parallel and waits for them to return or for timeout to pass.
func WaitIfExiting ¶
func WaitIfExiting()
WaitIfExiting blocks for good once the handler has begun cleaning up before exiting. Fatal error paths call it, because cleanup such as removing a container makes in-flight work fail, and exiting on that failure would beat the handler and report an error instead of the signal.
Types ¶
This section is empty.