-1

Quite a few commands from OSX ignore SIGINT from CTRL + C, while SIGQUIT from CTRL + \ does the job.

The zsh(1) key-binding intr looks correct by default. Is SIGINT deprecated in some way? I believe this used to work on previous releases.

% stty -a
speed 9600 baud; 30 rows; 113 columns;
lflags: icanon isig iexten echo echoe -echok echoke -echonl echoctl
    -echoprt -altwerase -noflsh -tostop -flusho pendin -nokerninfo
    -extproc
iflags: -istrip icrnl -inlcr -igncr ixon -ixoff ixany imaxbel iutf8
    -ignbrk brkint -inpck -ignpar -parmrk
oflags: opost onlcr -oxtabs -onocr -onlret
cflags: cread cs8 -parenb -parodd hupcl -clocal -cstopb -crtscts -dsrflow
    -dtrflow -mdmbuf
cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = <undef>;
    eol2 = <undef>; erase = ^?; intr = ^C; kill = ^U; lnext = ^V;
    min = 1; quit = ^\; reprint = ^R; start = ^Q; status = ^T;
    stop = ^S; susp = ^Z; time = 0; werase = ^W;
% which iostat
/usr/sbin/iostat
% iostat 1
              disk0               disk4       cpu    load average
    KB/t  tps  MB/s     KB/t  tps  MB/s  us sy id   1m   5m   15m
   20.69   32  0.66    32.81  210  6.74   3  2 96  1.10 1.33 1.36
   15.33   12  0.18    36.94  301 10.87  15  4 81  1.10 1.33 1.36
   16.00   20  0.31    23.12  289  6.53   7  2 90  1.10 1.33 1.36
^C    0.00    0  0.00     7.86  205  1.57   2  1 97  1.09 1.32 1.36
    0.00    0  0.00     7.61  197  1.46   1  1 98  1.09 1.32 1.36
    0.00    0  0.00     8.11  179  1.42   1  1 98  1.09 1.32 1.36
    0.00    0  0.00     7.54  183  1.35   1  1 98  1.09 1.32 1.36
^\zsh: quit       iostat 1
% 
Pascal de Kloe
  • 523
  • 4
  • 12
  • Adding details which commands are affected by the problem might help. – Bodo Aug 29 '23 at 14:38
  • How about the iostat(1) example given @Bodo? – Pascal de Kloe Aug 29 '23 at 14:51
  • 2
    Does `kill -2 pid_of_command` work? – Fravadona Aug 29 '23 at 15:10
  • Is this the only command? With a few examples of commands affected or not affected by the problem, it might be possible to see a pattern or some common ground. – Bodo Aug 29 '23 at 15:12
  • 1
    @PascaldeKloe try `iostat 1 &; sleep 5; pkill -INT iostat` to make it a bit more clear where sigint is ignored – yvs2014 Aug 29 '23 at 15:15
  • Good call @yvs2014. An `iostat 5 > /dev/null &; kill -INT %1` gets `[1] + interrupt iostat 5 > /dev/null` so the signal itself works as a command termination. – Pascal de Kloe Aug 29 '23 at 15:39
  • Interactive commands like top(1) ignore CTRL + C, yet find(1), grep(1), make(1) and cat(1) terminate. – Pascal de Kloe Aug 29 '23 at 15:49
  • @PascaldeKloe what if you try to interrupt 'iostat' which runs watching only one disk (for example disk0), or pressing ctrl-c a couple times? those zeros just after ^C in the output above looks a bit unexpected – yvs2014 Aug 29 '23 at 18:03
  • Now all commands terminate nicely with CTRL + C, including iostat(1) and top(1). I have no explaination. Multiple tries did not help the other day @yvs2014—tried that too. – Pascal de Kloe Aug 29 '23 at 18:51
  • And there it is again. Multiple signals including long delays have no effect. https://gist.github.com/pascaldekloe/5397ba482f6648b9692598f6ce47a7d9 Looks like a bug rather than a knowledge question now. Thanks for the help all. – Pascal de Kloe Aug 30 '23 at 12:44

0 Answers0