[comp.unix.shell] Interrupt Signals

mark@hsi.com. (Mark Sicignano) (10/08/90)

I have a program that when run, fork()s, the parent exits, and 
the child continues to run in the background.  

I don't handle any signals specially.  I fire up this program
in my .profile, but when I press ^C, my keyboard interrupt,
the program exits.  If I run this program at my prompt, however,
the program does not exit when I press the ^C.  

Why is this so??

Ksh Version 11/16/88d on a 4.3 BSD system.

-mark
-- 
Mark Sicignano                                  ...!uunet!hsi!mark
3M Health Information Systems                   mark@hsi.com

chet@cwns1.INS.CWRU.Edu (Chet Ramey) (10/09/90)

Mark Sicignano writes:
$ I have a program that when run, fork()s, the parent exits, and 
$ the child continues to run in the background.  
$ 
$ I don't handle any signals specially.  I fire up this program
$ in my .profile, but when I press ^C, my keyboard interrupt,
$ the program exits.  If I run this program at my prompt, however,
$ the program does not exit when I press the ^C.  
$ 
$ Why is this so??

Because ksh does not turn on job control until after the startup files
are read and executed.  This means that all processes started from these
files are in the same process group as the shell and therefore subject
keyboard-generated signals such as SIGINT.

Chet
-- 
Chet Ramey			``As I recall, Doug was keen on boxing.  But
Network Services Group		  when he learned to walk, he took up puttin'
Case Western Reserve University	  the boot in the groin.''
chet@ins.CWRU.Edu