Merge pull request #1802 from hashicorp/b-ignore-sigpipe

Skip SIGPIPE
This commit is contained in:
Alex Dadgar 2016-10-11 10:40:39 -07:00 committed by GitHub
commit a6e82f0327
1 changed files with 6 additions and 1 deletions

View File

@ -474,7 +474,7 @@ func (c *Command) Run(args []string) int {
// handleSignals blocks until we get an exit-causing signal
func (c *Command) handleSignals(config *Config) int {
signalCh := make(chan os.Signal, 4)
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:
@ -489,6 +489,11 @@ WAIT:
}
c.Ui.Output(fmt.Sprintf("Caught signal: %v", sig))
// Skip any SIGPIPE signal (See issue #1798)
if sig == syscall.SIGPIPE {
goto WAIT
}
// Check if this is a SIGHUP
if sig == syscall.SIGHUP {
if conf := c.handleReload(config); conf != nil {