Merge pull request #2553 from mckennajones/bug/ignoresigpipe

Ignore sigpipe signals
This commit is contained in:
Kyle Havlovitz 2016-12-14 15:36:26 -05:00 committed by GitHub
commit 7fbac3ffad
1 changed files with 6 additions and 0 deletions

View File

@ -946,6 +946,7 @@ func (c *Command) Run(args []string) int {
func (c *Command) handleSignals(config *Config, retryJoin <-chan struct{}, retryJoinWan <-chan struct{}) int { func (c *Command) handleSignals(config *Config, retryJoin <-chan struct{}, retryJoinWan <-chan struct{}) int {
signalCh := make(chan os.Signal, 4) signalCh := make(chan os.Signal, 4)
signal.Notify(signalCh, os.Interrupt, syscall.SIGTERM, syscall.SIGHUP) signal.Notify(signalCh, os.Interrupt, syscall.SIGTERM, syscall.SIGHUP)
signal.Notify(signalCh, os.Interrupt, syscall.SIGTERM, syscall.SIGHUP, syscall.SIGPIPE)
// Wait for a signal // Wait for a signal
WAIT: WAIT:
@ -971,6 +972,11 @@ WAIT:
} }
c.Ui.Output(fmt.Sprintf("Caught signal: %v", sig)) c.Ui.Output(fmt.Sprintf("Caught signal: %v", sig))
// Skip SIGPIPE signals
if sig == syscall.SIGPIPE {
goto WAIT
}
// Check if this is a SIGHUP // Check if this is a SIGHUP
if sig == syscall.SIGHUP { if sig == syscall.SIGHUP {
conf, err := c.handleReload(config) conf, err := c.handleReload(config)