The osutil.Unsetenv function is not used. Today, os.Unsetenv exists
in the standard library, and is already used elsewhere in etcd.
Removing this function could break things that may be importing this
package. According to pkg.go.dev, it seems like the only thing is
etcd forks, so it may be worth getting rid of this code. See:
https://pkg.go.dev/github.com/coreos/etcd/pkg/osutil?tab=importedby
Signed-off-by: Evan Jones <ej@evanjones.ca>
The go runtime won't always reinstall the default signal handler on the
SIGTERM path, so it's possible the signal won't terminate the process.
Instead, force SIG_DFL for the signal.
The functionality in pkg/osutil ensures that all interrupt handlers finish
and the process kills itself with the proper signal.
Test for interrupt handling added.
The server shutsdown gracefully by stopping on interrupt (Issue #2277.)