Skip to content

Commit

Permalink
Merge pull request #2553 from mckennajones/bug/ignoresigpipe
Browse files Browse the repository at this point in the history
Ignore sigpipe signals
  • Loading branch information
kyhavlov authored Dec 14, 2016
2 parents 3eeff54 + 8b3ab10 commit 7fbac3f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions command/agent/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,7 @@ func (c *Command) Run(args []string) int {
func (c *Command) handleSignals(config *Config, retryJoin <-chan struct{}, retryJoinWan <-chan struct{}) 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 @@ -971,6 +972,11 @@ WAIT:
}
c.Ui.Output(fmt.Sprintf("Caught signal: %v", sig))

// Skip SIGPIPE signals
if sig == syscall.SIGPIPE {
goto WAIT
}

// Check if this is a SIGHUP
if sig == syscall.SIGHUP {
conf, err := c.handleReload(config)
Expand Down

0 comments on commit 7fbac3f

Please sign in to comment.