Win32::Job is indeed the module to use if you want to be sure you catch all 
child processes too.  It requires Windows 2000 or later.
You'll need to show us some sample code and explain how it didn't work for you 
if you expect additional help with it.

 

As for Win32::Process, you should be able to use kill(-9, $pid) at least with 
reasonably newish ActivePerl versions to kill $pid and
all its children.

 

Cheers,

-Jan

 

From: [email protected] 
[mailto:[email protected]] On Behalf Of Aclhk Aclhk
Sent: Tuesday, July 28, 2009 2:17 AM
To: Bill Luebkert
Cc: [email protected]
Subject: Re: fork and kill process

 


if we use Win32::Process, we could not kill all associated child processes.

--- 2009年7月28日 星期二,Bill Luebkert <[email protected]> ��道�s


寄件人: Bill Luebkert <[email protected]>
主�}: Re: fork and kill process
收件人: "Aclhk Aclhk" <[email protected]>
副本(CC): [email protected]
日期: 2009年7月28日,星期二,上午9:14

Aclhk Aclhk wrote:
> i am new to writing perl in windows. I would like to achieve the same 
> result from the following code:
> 
> $pid = fork();
> defined $pid or die "fork($pid)\n";
> if($pid == 0)
> {
> exec("dir");
> }
> 
> sleep(10);
> kill("TERM" => $pid);
> 
> I would to spawn a process and kill it (including the child process) at 
> later time.
> 
> Pls advise what code should be in windows environment. someone suggested 
> win32::job but i failed to write a success code.

Check out Win32::Process and see if it will do what you need.

 

  _____  

Yahoo!香港提供�W上安全攻略,教你如何防��黑客! <http://hk.promo.yahoo.com/security/> 了解更多

_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to