only ignore interrupt signal after input
authorMischa POSLAWSKY <perl@shiar.org>
Wed, 11 Sep 2019 14:55:40 +0000 (16:55 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Thu, 12 Sep 2019 15:48:11 +0000 (17:48 +0200)
Assume no input is an unpiped invocation a user tries to abort by ctrl-C.

barcat

diff --git a/barcat b/barcat
index 1b780e618d23620456c984ad6e61b36bd2438c78..2f73fa5ab2c59e3e8be6ce6b0b57fd235641587a 100755 (executable)
--- a/barcat
+++ b/barcat
@@ -100,6 +100,7 @@ if (defined $opt{interval}) {
 
 $SIG{INT} = sub {
        $SIG{INT} = 'DEFAULT';  # reset for subsequent attempts
 
 $SIG{INT} = sub {
        $SIG{INT} = 'DEFAULT';  # reset for subsequent attempts
+       exit if !$.;
        'IGNORE' # continue after assumed eof
 };
 
        'IGNORE' # continue after assumed eof
 };