diff --git a/cmd/age-passgen/main.go b/cmd/age-passgen/main.go index 61da44f..225571e 100644 --- a/cmd/age-passgen/main.go +++ b/cmd/age-passgen/main.go @@ -101,6 +101,18 @@ func main() { } 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) {