cederom commented on PR #18116:
URL: https://github.com/apache/nuttx/pull/18116#issuecomment-3786330236
> @cederom do you know if FreeBSD also do like Linux in this case?
This looks bad idea to use Ctrl+C to kill background jobs, because you can
kill many jobs that way accidentally? Ctrl+C generates a signal that is handled
by _current_ application only.
Foreground, Ctrl+C kills the top.
```
% top <-- Ctrl+C exits top
%
```
When in the background Ctrl+C does not kill process.. and it should not
because why.. Ctrl+C signal is directed to the current process that is shell
right? You need to `fg` and then Ctrl+C sends the signal to the current process
in the foreground:
Tested in `zsh` (note I have two top already running as tmux plugins):
```
hexagon% ps | grep top
4685 4 TN 0:00,00 top
5885 4 TN 0:00,00 top
10997 4 SN+ 0:00,00 grep top
hexagon% top
<-- Ctrl+Z
zsh: suspended top
hexagon% <-- Ctrl+C does nothing.
hexagon% ps | grep top
4685 4 TN 0:00,00 top
5885 4 TN 0:00,00 top
11197 4 TN 0:00,01 top
11606 4 SN+ 0:00,00 grep top
hexagon% fg
[3] continued top <-- Ctrl+C kills top.
hexagon% ps | grep top
4685 4 TN 0:00,00 top
5885 4 TN 0:00,00 top
```
The same in `bash`:
```
[cederom@hexagon ~]$ ps | grep top
4685 4 TN 0:00,00 top
5885 4 TN 0:00,00 top
25260 4 RN+ 0:00,00 grep top
[cederom@hexagon ~]$ top <-- Ctrl+C exits top.
[cederom@hexagon ~]$ ps | grep top
4685 4 TN 0:00,00 top
5885 4 TN 0:00,00 top
25529 4 SN+ 0:00,00 grep top
[cederom@hexagon ~]$ top <-- Ctrl+Z brings top to back.
[1]+ Stopped top
[cederom@hexagon ~]$ ps | grep top
4685 4 TN 0:00,00 top
5885 4 TN 0:00,00 top
25716 4 TN 0:00,00 top <-- here it is.
[cederom@hexagon ~]$ ^C <-- Ctrl+C does nothing here.
[cederom@hexagon ~]$ ps | grep top
4685 4 TN 0:00,00 top
5885 4 TN 0:00,00 top
25716 4 TN 0:00,00 top <-- top still here.
[cederom@hexagon ~]$ fg <-- bring top to foreground.
top <-- Ctrl+X kills top.
[cederom@hexagon ~]$ ps | grep top
4685 4 TN 0:00,00 top
5885 4 TN 0:00,00 top
26616 4 SN+ 0:00,00 grep top
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]