unix 命令行上忽略的错误信号

4szc88ey  于 8个月前  发布在  Unix
关注(0)|答案(1)|浏览(112)

OSX中有相当多的命令会忽略CTRL + C中的SIGINT,而CTRL + \中的SIGQUIT会完成这项工作。
默认情况下,zsh(1)键绑定intr看起来是正确的。信号情报在某种程度上被弃用了吗?我相信这在以前的版本中是有用的。

% 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
%
oxosxuxt

oxosxuxt1#

这似乎是一个随机发生的bug,并且 * 仅 * 当vi(1)在后台时。在忽略中断后关闭vi(1)并不能解决问题。出现问题后,需要重新启动shell才能恢复正常。

% vi --version
VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Jun 23 2023 22:12:29)
macOS version - arm64
Included patches: 1-1544
Compiled by [email protected]

完整日志可在https://gist.github.com/pascaldekloe/5397ba482f6648b9692598f6ce47a7d9上获得。

相关问题