handle sigpipe for user friendliness
This commit is contained in:
parent
bd018136d6
commit
5184859c54
@ -101,6 +101,18 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func setSystemSignalHandlers() {
|
func setSystemSignalHandlers() {
|
||||||
|
go handleSigpipe()
|
||||||
|
}
|
||||||
|
|
||||||
|
func handleSigpipe() {
|
||||||
|
c := make(chan os.Signal, 1)
|
||||||
|
signal.Notify(c, os.Interrupt, syscall.SIGPIPE)
|
||||||
|
|
||||||
|
<-c
|
||||||
|
|
||||||
|
errorf("Recieved SIGPIPE. Check if your programs that give input or recieve input do not stops before this one")
|
||||||
|
|
||||||
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseFlags() (*Flags, error) {
|
func parseFlags() (*Flags, error) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user