acassis commented on PR #18116:
URL: https://github.com/apache/nuttx/pull/18116#issuecomment-3789767402

   > > @cederom I think Ctrl+C will break only the last job sent to background:
   > > ```
   > > $ gedit &
   > > [1] 104015
   > > 
   > > $ top &
   > > [2] 104029
   > > $ ^C
   > > 
   > > [2]+  Stopped                 top
   > > $
   > > ```
   > > 
   > > 
   > >     
   > >       
   > >     
   > > 
   > >       
   > >     
   > > 
   > >     
   > >   
   > > In fact this is a good improvement, we just need to guarantee that it is 
doing the right thing.
   > > @Gary-Hobson please test sending two process to background and test to 
confirm it will only terminate the last one.
   > 
   > The current code doesn't terminate any background processes, and as I see 
it, terminating background processes probably isn't a good idea.
   > 
   > Below are the steps for my test:
   > 
   >     1. Modify the code in hello_main.c:
   > 
   > 
   > ```c
   > int main(int argc, FAR char *argv[])
   > {
   >   printf("Hello, World!!\n");
   >   sleep(30);
   >   return 0;
   > }
   > ```
   > 
   >     2. Configure and compile the project:
   > 
   > 
   > ```shell
   > ./tools/configure.sh mps2-an500/nsh
   > make menuconfig
   > 
   > # Add the following two configurations:
   > CONFIG_SIG_DEFAULT=y
   > CONFIG_TTY_SIGINT=y
   > 
   > make -j
   > ```
   > 
   > Run the test on QEMU:
   > 
   > ```shell
   > qemu-system-arm -M mps2-an500 -cpu cortex-m7 -nographic -kernel ./nuttx
   > 
   > nsh> hello
   > press Ctrl+C
   > nxtask_exit: hello pid=3,TCB=0x60007410
   > nsh>
   > ```
   
   @Gary-Hobson yes, I think I read background instead foreground and decided 
to test it on Linux. But I agree it not a good idea to kill a background 
process using Ctrl+C. I was surprised to see the Linux shell doing it.


-- 
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]

Reply via email to