Code Comments
Programming Forum and web based access to our favorite programming groups.Hi All, I ran into a scenario that I initiate from system(), however, the process doesn't exit and hang over there. I am just wondering if there is a way to kill the process after half hour run no matter it is healthy or not. Regards,
Post Follow-up to this messageHoward wrote:
> Hi All,
>
> I ran into a scenario that I initiate from system(), however, the
> process doesn't exit and hang over there. I am just wondering if there
> is a way to kill the process after half hour run no matter it is
> healthy or not.
>
> Regards,
perldoc -f alarm
Thomas
--
$/=$,,$_=<DATA>,s,(.*),$1,see;__END__
s,^(.*\043),,mg,@_=map{[split'']}split;{#>J~.>_an~>>e~......>r~
$_=$_[$%][$"];y,<~>^,-++-,?{$/=--$|?'"':#..u.t.^.o.P.r.>ha~.e..
'%',s,(.),\$$/$1=1,,$;=$_}:/\w/?{y,_, ,,#..>s^~ht<._..._..c....
print}:y,.,,||last,,,,,,$_=$;;eval,redo}#.....>.e.r^.>l^..>k^.-
Post Follow-up to this messageHoward <hao.luan@gmail.com> wrote in comp.lang.perl.misc: > Hi All, > > I ran into a scenario that I initiate from system(), however, the > process doesn't exit and hang over there. I am just wondering if there > is a way to kill the process after half hour run no matter it is > healthy or not. That will be hard to do, because system() only returns after the external process has ended. You could set an alarm timer and kill the process from the signal handler if you knew the pid, but you don't. You'll be much better off creating the child process yourself, probably using explicit fork. The parent process knows the pid and can kill the child process when it runs too long. Anno
Post Follow-up to this messageThomas Kratz <ThomasKratz@REMOVEwebCAPS.de> wrote in comp.lang.perl.misc: > Howard wrote: > > > perldoc -f alarm Fine if you know what pid to kill, but with system() you don't. Anno
Post Follow-up to this messageAnno Siegel wrote:
> Thomas Kratz <ThomasKratz@REMOVEwebCAPS.de> wrote in comp.lang.perl.misc:
>
>
>
> Fine if you know what pid to kill, but with system() you don't.
>
> Anno
You're right. Foggy memory, I really should test before posting.
It's time to go home now :-)
Thomas
--
$/=$,,$_=<DATA>,s,(.*),$1,see;__END__
s,^(.*\043),,mg,@_=map{[split'']}split;{#>J~.>_an~>>e~......>r~
$_=$_[$%][$"];y,<~>^,-++-,?{$/=--$|?'"':#..u.t.^.o.P.r.>ha~.e..
'%',s,(.),\$$/$1=1,,$;=$_}:/\w/?{y,_, ,,#..>s^~ht<._..._..c....
print}:y,.,,||last,,,,,,$_=$;;eval,redo}#.....>.e.r^.>l^..>k^.-
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.