- All supported platforms can handle the same set of signals we're
interested in, thus we don't need build contraints to use a set of
signals on Linux, while restricting ourselves to only SIGINT on Darwin
and Windows.
- According to the documentation of os/signal, similar to SIGINT and
SIGTERM, SIGHUP causes the program to exit, therefore add it to the
list of handled signals.
Signed-off-by: Rodolfo Carvalho <rcarvalh@redhat.com>
os/signal.Stop() does not actually close the channel, which means
the channel is blocked. Not serious because we don't use interrupt
protection on the server, just the CLI (which can afford 1 leaked
goroutine).
Currently attach and the editor do not share the same logic for saving
and restoring the terminal, and are not suitable for nesting (when the
caller wants to create something, attach, and then delete something when
the attach is over). This commit moves the interrupt protection logic
to a util package and supports nesting interrupt handlers.