Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

how to kill a process initiated by system()
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,

Report this thread to moderator Post Follow-up to this message
Old Post
Howard
10-27-04 08:57 PM


Re: how to kill a process initiated by system()
Howard 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^.-

Report this thread to moderator Post Follow-up to this message
Old Post
Thomas Kratz
10-27-04 08:57 PM


Re: how to kill a process initiated by system()
Howard <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

Report this thread to moderator Post Follow-up to this message
Old Post
Anno Siegel
10-27-04 08:57 PM


Re: how to kill a process initiated by system()
Thomas 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

Report this thread to moderator Post Follow-up to this message
Old Post
Anno Siegel
10-27-04 08:57 PM


Re: how to kill a process initiated by system()
Anno 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^.-

Report this thread to moderator Post Follow-up to this message
Old Post
Thomas Kratz
10-27-04 08:57 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PERL Miscellaneous archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 04:59 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.