Skip to content

Commit

Permalink
Merge pull request #1802 from hashicorp/b-ignore-sigpipe
Browse files Browse the repository at this point in the history
Skip SIGPIPE
  • Loading branch information
dadgar committed Oct 11, 2016
2 parents bf112a5 + 3a4bb56 commit 9e02248
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion command/agent/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 {
Expand Down

0 comments on commit 9e02248

Please sign in to comment.