traping signals

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

In a script, I trap the interrupt and quit signals.  I would like all
the other signals to be ignored.  Is there a simple way to do it?


Re: traping signals wrote:
Quoted text here. Click to load it
perldoc sigtrap
perldoc perlipc


Re: traping signals

On 2005-05-05, Charles DeRykus scribbled these
curious markings:
> Not really. If Unix-based and kill(1) supports -l , you
> could grab the list and set the other signals to ignore:

[non-portable code snipped]

Instead of giving platform-specific code that returns tainted data, why
not just use the example given in perlipc?

I quote:

       The names of the signals are the ones listed out by "kill -l" on
your system, or you can retrieve them from the Config module.  Set up an
@signame list indexed by number to get the name and a %signo table
indexed by name to get the number:

use Config;
defined $Config || die "No sigs?";
foreach $name (split(' ', $Config)) {
    $signo = $i;
    $signame[$i] = $name;

End quote.

Best Regards,
Christopher Nehren
I abhor a system designed for the "user", if that word is a coded
pejorative meaning "stupid and unsophisticated". -- Ken Thompson
If you ask the wrong questions, you get answers like "42" and "God".
Unix is user friendly. However, it isn't idiot friendly.

Site Timeline