From 8b3ab100ef0e74a5d4d3b0ef248a2cc2a2097b04 Mon Sep 17 00:00:00 2001 From: mckennajones Date: Wed, 30 Nov 2016 09:42:10 -0800 Subject: [PATCH] ignore sigpipe signals to fix journalctl issue #2404 --- command/agent/command.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/command/agent/command.go b/command/agent/command.go index d47537363a..6afc6e496f 100644 --- a/command/agent/command.go +++ b/command/agent/command.go @@ -943,6 +943,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: @@ -964,6 +965,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 { if conf := c.handleReload(config); conf != nil {