tags:

views:

185

answers:

1

Is it possible to start a process with exec and have that process run in the background, and (unlike System()), will that process be killed once an interrupt signal is passed to the parent process that created it?

+1  A: 

Yeah. Ignoring SIGINT is a behavior specific to system(). If you roll your own system() using fork() and execl(), you won't get that.

Of course, unless you're really careful you're going to make zombies.

chaos
Not sure about the zombie comment - if the parent ignores the SIGCHLD signal, no zombies will be created. Also, the process can wait for its child (or children) to die, just like system() does - or it can run asynchronously with the child running at the same time.
Jonathan Leffler
Those options are pretty much what I mean by "being really careful". :)
chaos