Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Kill and Signals

Reply
Thread Tools

Kill and Signals

 
 
Isidro Vila Verde
Guest
Posts: n/a
 
      11-16-2003
Greetings,

I need to handle signals to close some excel applications that my
script open, when the script is killed by another process.

My script is a little bit complex, but I wrote just two very small
scripts to test the kill and signal.

The scripts signal.pl is this one:
map {$SIG{$_} = sub {my $n = shift; print "n=$n\n"}} keys %SIG;
#just in case
$SIG{INT} = sub {my $n = shift; print "n=$n\n"};
print "pid = $$\n";
sleep 1 while(1)

And the second one (kill.pl) is just the following line:
kill ($ARGV[0] => $ARGV[1]);

What I call the second like this:
>perl kill.pl INT pid_returned_from_first_script


I expected the signal to be handled by fisrt script, but no matter
what signal I sent, the first script never receives the signal. It
just was killed without any signal handling.

Does anyone know what I am doing wrong here?

Isidro
 
Reply With Quote
 
 
 
 
Roy Johnson
Guest
Posts: n/a
 
      11-20-2003
This newsgroup is defunct. You will reach more people on
comp.lang.perl.misc.

http://www.velocityreviews.com/forums/(E-Mail Removed) (Isidro Vila Verde) wrote in message news:<(E-Mail Removed). com>...
> I need to handle signals to close some excel applications that my
> script open, when the script is killed by another process.


Presumably, you're using ActivePerl.

http://aspn.activestate.com/ASPN/doc...ignal_Handling
Signals are unsupported by the Win32 API. The C Runtime provides crude
support for signals, but there are serious caveats, such as inability
to die() or exit() from a signal handler. Perl itself does not
guarantee that signal handlers will not interrupt critical operations
such as memory allocation, which means signal invocation may throw
perl internals into disarray. For these reasons, signals are
unsupported at this time.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Data structures and signals and stuff. Murph VHDL 9 12-07-2006 06:07 PM
Signals and variables, concurrent and sequential assignments Taras_96 VHDL 5 04-14-2005 03:07 AM
KILL BABY KILL widescreen drsd2kill DVD Video 3 11-29-2004 09:36 PM
Bava's KILL BABY KILL widescreen drsd2kill DVD Video 0 11-27-2004 12:04 AM
Internal Signals and other questions with ModelSim XE/II Starter 5.7g VHDL Testbench Martin Maurer VHDL 2 05-21-2004 03:45 AM



Advertisments