Skip to content

Commit

Permalink
tail: less confusing signals for -f flag (#874)
Browse files Browse the repository at this point in the history
* GNU version terminates "tail -f" instance on ctrl-c
* Allowing ctrl-c to terminate program will do what the user expects
* Steal the existing SIGQUIT handler for the purpose of showing file report
* Update pod manual; only SIGQUIT needs to be mentioned now
  • Loading branch information
mknos authored Dec 16, 2024
1 parent 6c194e4 commit c2dbf20
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions bin/tail
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,7 @@ sub tail_f
@filelist = @{ $files };
@dirlist = @{ $dirs };

local $SIG{'INT'} = \&handle_INT;
local $SIG{'QUIT'} = sub { exit 0 }; # do not core dump
local $SIG{'QUIT'} = \&handle_INT;

my ($ino, $size, $mtime);

Expand Down Expand Up @@ -382,7 +381,7 @@ sub handle_INT

# On some systems (NT, for instance), it is necessary to
# reinstall the signal handler
$SIG{'INT'} = \&handle_INT;
$SIG{'QUIT'} = \&handle_INT;
}

#
Expand Down Expand Up @@ -491,9 +490,8 @@ line doesn't exist, the program will watch for it and monitor it once
created. When switching files in the display, a banner showing the
pathname of the file is printed.
An interrupt character (usually CTRL/C or DEL) will display a list of
the most recently modified files being watched. Send a quit signal
(usually CTRL/backslash) to stop the program.
Send a quit signal (usually CTRL/backslash) to display a list of
the most recently modified files being watched.
The options are the following for I<tail> (no options are
supported by I<xtail>) :
Expand Down

0 comments on commit c2dbf20

Please sign in to comment.