Supress signal logging on SIGPIPE. Should address #2768

When consul-template is communicating with consul and the job is done, consul thread receives SIGPIPE.

This cause the logs to be filled "Caught signal: broken pipe" and they does not bring any usefull info with them.

Skipping those.
This commit is contained in:
vaLentin chernoZemski 2017-03-29 09:46:58 +03:00
parent e081b39014
commit 1e5163d241
1 changed files with 3 additions and 2 deletions

View File

@ -1167,13 +1167,14 @@ WAIT:
// Agent is already shutdown!
return 0
}
c.Ui.Output(fmt.Sprintf("Caught signal: %v", sig))
// Skip SIGPIPE signals
// Skip SIGPIPE signals and skip logging whenever such signal is received as well
if sig == syscall.SIGPIPE {
goto WAIT
}
c.Ui.Output(fmt.Sprintf("Caught signal: %v", sig))
// Check if this is a SIGHUP
if sig == syscall.SIGHUP {
conf, err := c.handleReload(config)