I've got a perl script that uses system() to spawn a program that
should not be interrupted. I can't modify that subprogram itself, so I
currently do:
{
local $SIG{INT} = 'IGNORE';
system("some_thing");
}
That works (the perl process ignores SIGINT, preventing it from
getting to the some_thing process) but we want to be more friendly,
and let the user know why control-C didn't kill the process. How do I
catch the SIGINT and print a msg, but not propagate the sig to the
spawned process?
I thought I wanted:
local $SIG{INT} = sub { print "not interrupt allowed at this time\n" };
but that still results in my some_thing process aborting.
Interestingly, this appears to contradict perlfaq8 ("How do I make a
system() exit on control-C?"), which says I need two write a handler
in the parent to propagate the SIGINT To the system()'ed process.
I'm on OS X, using 5.8.1 (part of Apple's 10.3.x system) or 5.8.6
(compiled by Fink).
dan
--
Daniel Macks
XXXX@XXXXX.COM
http://www.netspace.org/~dmacks