All,

I have a need to spawn a command from a Perl script, time it out, and kill 
it if the timeout occurs. Under Perl 5.6.1, something like the following 
worked:

$| = 1;
my $cmd = "whatever comand I want to issue";
my $tmot = 30;  # Timeout in seconds.
my $pipe;
my $pid = open ($pid, "$cmd|") or die;
local $SIG{ALRM} = sub {
    kill KILL => $pid;
    }
alarm ($tmot);
while (<$pipe>) {print}
alarm (0);

But under 5.8.4, it doesn't. What appears to happen is that the <$pipe> 
prevents the signal from being delivered. I thought the "kill" wasn't 
working for a while, but when I substituted the corresponding "stop/id" it 
kept reporting "no such process"

Other vitals:
VMS: 7.1-1H2
C: DEC C V5.6-003

Has anyone got a useful way to get this done under 5.8.4? I suppose the 
four-argument "select" is one way to get it done, but I was hoping to get 
away without having to resort to the wonders of unbuffered I/O. And I 
really hate the thought of spawning another subprocess with a DCL "wait" 
followed by a STOP/ID".

Thanks,
Tom Wyant


This communication is for use by the intended recipient and contains 
information that may be privileged, confidential or copyrighted under
applicable law.  If you are not the intended recipient, you are hereby
formally notified that any use, copying or distribution of this e-mail,
in whole or in part, is strictly prohibited.  Please notify the sender
by return e-mail and delete this e-mail from your system.  Unless
explicitly and conspicuously designated as "E-Contract Intended",
this e-mail does not constitute a contract offer, a contract amendment,
or an acceptance of a contract offer.  This e-mail does not constitute
a consent to the use of sender's contact information for direct marketing
purposes or for transfers of data to third parties.

 Francais Deutsch Italiano  Espanol  Portugues  Japanese  Chinese  Korean

            http://www.DuPont.com/corp/email_disclaimer.html


Reply via email to