File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ func main() {
2222 // Create a channel to receive OS signals.
2323 osSignalChannel := make (chan os.Signal , 1 )
2424 // Notify the channel on os.Interrupt, syscall.SIGTERM. os.Kill cannot be caught.
25- signal .Notify (osSignalChannel , os .Interrupt , syscall .SIGTERM )
25+ signal .Notify (osSignalChannel , os .Interrupt , syscall .SIGTERM , syscall . SIGPIPE )
2626
2727 ctx , cancel := context .WithCancel (context .Background ())
2828
@@ -31,6 +31,12 @@ func main() {
3131 // wait for exit signal
3232 signal = <- osSignalChannel
3333 logger .Logger .WithField ("signal" , signal ).Info ("Received OS signal" )
34+
35+ if signal == syscall .SIGPIPE {
36+ logger .Logger .WithField ("signal" , signal ).Warn ("Ignoring SIGPIPE signal" )
37+ return
38+ }
39+
3440 cancel ()
3541 }()
3642
You can’t perform that action at this time.
0 commit comments