in reply to Re: Allowing user to abort waitpid
in thread Allowing user to abort waitpid

Oh, I forgot to add: Control-C (or 'A') will send the signal to your child too. If you install the handler after fork, the child will get killed, which, it seems, is what you want? But if you don't want that, set $SIG{INT} to 'IGNORE' before fork, and after fork install your handler (it should probably be an empty sub, as in $SIG{INT} = sub {};)

Replies are listed 'Best First'.
Re^3: Allowing user to abort waitpid
by salva (Canon) on Mar 07, 2016 at 09:55 UTC
    Moving the child to its own process group (setpgrp(0,0)) would also avoid getting the INT signal when the user presses a Control-c.
      Sure, there is a number of ways to do it. setpgrp is not in (Perl's) POSIX, but it has setpgid. Doing that will have other consequences wrt SIGQUIT, SIGHUP etc. Probably not a problem in practice, though.

      Come to think of it, system might also be close to what the OP is trying to do...

        setpgrp is not in (Perl's) POSIX
        Hah, I forgot those built-in Perl's Unix functions :)