fork and kill process

--===============0526490626==
Content-Type: multipart/alternative; boundary="0-1748036663-1248768753=:77951"


--0-1748036663-1248768753=:77951
Content-Type: text/plain; charset=big5
Content-Transfer-Encoding: quoted-printable

i am new to writing perl in windows. I would like to achieve the same resul=
t from the following code:

$pid =3D fork();
defined $pid or die "fork($pid)\n";
if($pid =3D=3D 0)
{
exec("dir");
}

sleep(10);
kill("TERM" =3D> $pid);

I would to spawn a process and kill it (including the child process) at lat=
er time.

Pls advise what code should be in windows environment. someone suggested wi=
n32::job but i failed to write a success code.
=0A=0A=0A Yahoo!=AD=BB=B4ä=B4=A3=A8=D1=BA=F4=A4W=A6w=A5=FE=A7=F0=B2=
=A4=A1A=B1=D0=A7A=A6p=A6=F3=A8=BE=BDd=B6=C2=AB=C8! =BD=D0=ABe=A9=B9 http://=
hk.promo.yahoo.com/security/ =A4F=B8=D1=A7=F3=A6h!
--0-1748036663-1248768753=:77951
Content-Type: text/html; charset=big5
Content-Transfer-Encoding: quoted-printable

<table cellspacing=3D"0" cellpadding=3D"0" border=3D"0" ><tr><td valign=3D"=
top" style=3D"font: inherit;">i am new to writing perl in windows. I would =
like to achieve the same result from the following code:<br><br>$pid =3D fo=
rk();<br>defined $pid or die "fork($pid)\n";<br>if($pid =3D=3D 0)<br>{<br>e=
xec("<span style=3D"text-decoration: underline;">dir</span><!-- m -->");<br=
>}<br><br>sleep(10);<br>kill("TERM" =3D> $pid);<br><br>I would to spawn =
a process and kill it (including the child process) at later time.<br><br>P=
ls advise what code should be in windows environment. someone suggested win=
32::job but i failed to write a success code. <br></td></tr></table><br>=0A=
=0A=0A=0A=0A <hr size=3D1>Yahoo!=AD=BB=B4ä=B4=A3=A8=D1=BA=F4=
=A4W=A6w=A5=FE=A7=F0=B2=A4=A1A=B1=D0=A7A=A6p=A6=F3=A8=BE=BDd =B6=C2=AB=C8!<a=
href=3D"http://hk.promo.yahoo.com/security/"><b>=A4F=B8=D1=A7=F3=A6h</b></=
a>
--0-1748036663-1248768753=:77951--

--===============0526490626==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============0526490626==--
Aclhk Aclhk [ Di, 28 Juli 2009 10:12 ] [ ID #2010189 ]

Re: fork and kill process

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.
_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Bill Luebkert [ Di, 28 Juli 2009 11:14 ] [ ID #2010190 ]

Re: fork and kill process

--============== 28940081==
Content-Type: multipart/alternative; boundary="0-2121570317-1248772600=:49310"


--0-2121570317-1248772600=:49310
Content-Type: text/plain; charset=big5
Content-Transfer-Encoding: quoted-printable

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

--- 2009=A6~7=A4=EB28=A4=E9 =ACP=B4=C1=A4G=A1ABill Luebkert <dbecoll [at] roadru=
nner.com> =BCg=B9D=A1R

=B1H=A5=F3=A4H: Bill Luebkert <dbecoll [at] roadrunner.com>
=A5D=C3D: Re: fork and kill process
=A6=AC=A5=F3=A4H: "Aclhk Aclhk" <aclhkaclhk [at] ymail.com>
=B0=C6=A5=BB(CC): activeperl [at] listserv.ActiveState.com
=A4=E9=B4=C1: 2009=A6~7=A4=EB28=A4=E9,=ACP=B4=C1=A4G,=A4W=A4=C89: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 =3D fork();
> defined $pid or die "fork($pid)\n";
> if($pid =3D=3D 0)
> {
> exec("dir");
> }
>
> sleep(10);
> kill("TERM" =3D> $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.
=0A=0A=0A Yahoo!=AD=BB=B4ä=B4=A3=A8=D1=BA=F4=A4W=A6w=A5=FE=A7=F0=B2=
=A4=A1A=B1=D0=A7A=A6p=A6=F3=A8=BE=BDd=B6=C2=AB=C8! =BD=D0=ABe=A9=B9 http://=
hk.promo.yahoo.com/security/ =A4F=B8=D1=A7=F3=A6h!
--0-2121570317-1248772600=:49310
Content-Type: text/html; charset=big5
Content-Transfer-Encoding: quoted-printable

<table cellspacing=3D"0" cellpadding=3D"0" border=3D"0" ><tr><td valign=3D"=
top" style=3D"font: inherit;">if we use Win32::Process, we could not kill a=
ll associated child processes.<br><br>--- <b>2009=A6~7=A4=EB28=A4=E9 =ACP=
=B4=C1=A4G=A1ABill Luebkert <i><dbecoll [at] roadrunner.com></i></b> =BCg=
=B9D=A1R<br><blockquote style=3D"border-left: 2px solid rgb(16, 16, 255); m=
argin-left: 5px; padding-left: 5px;"><br>=B1H=A5=F3=A4H: Bill Luebkert <=
dbecoll [at] roadrunner.com><br>=A5D=C3D: Re: fork and kill process<br>=A6=AC=
=A5=F3=A4H: "Aclhk Aclhk" <aclhkaclhk [at] ymail.com><br>=B0=C6=A5=BB(CC):=
activeperl [at] listserv.ActiveState.com<br>=A4=E9=B4=C1: 2009=A6~7=A4=EB28=A4=
=E9,=ACP=B4=C1=A4G,=A4W=A4=C89:14<br><br><div class=3D"plainMail">Aclhk Acl=
hk wrote:<br>> i am new to writing perl in windows. I would like to achi=
eve the same <br>> result from the following code:<br>> <br>> $pid=
=3D fork();<br>> defined $pid or die "fork($pid)\n";<br>> if($pid =
=3D=3D 0)<br>> {<br>> exec("dir");<br>> }<br>> <br>>
sleep(10);<br>> kill("TERM" =3D> $pid);<br>> <br>> I would to =
spawn a process and kill it (including the child process) at <br>> later=
time.<br>> <br>> Pls advise what code should be in windows environme=
nt. someone suggested <br>> win32::job but i failed to write a success c=
ode.<br><br>Check out Win32::Process and see if it will do what you need.<b=
r></div></blockquote></td></tr></table><br>=0A =0A=0A=0A=0A <hr s=
ize=3D1>Yahoo!=AD=BB=B4ä=B4=A3=A8=D1=BA=F4=A4W=A6w=A5=FE=A 7=F0=B2=A4=A1A=
=B1=D0=A7A=A6p=A6=F3=A8=BE=BDd=B6=C2=AB=C8!<a href=3D"http://hk.promo.yahoo=
..com/security/"><b>=A4F=B8=D1=A7=F3=A6h</b></a>
--0-2121570317-1248772600=:49310--

--============== 28940081==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--============== 28940081==--
Aclhk Aclhk [ Di, 28 Juli 2009 11:16 ] [ ID #2010191 ]

Re: fork and kill process

--===============0746222600==
Content-Type: multipart/alternative; boundary="0-682413912-1248772695=:3704"


--0-682413912-1248772695=:3704
Content-Type: text/plain; charset=big5
Content-Transfer-Encoding: quoted-printable

fork is ok but forked process could not be killed.

--- 2009=A6~7=A4=EB28=A4=E9 =ACP=B4=C1=A4G=A1AXiao Yafeng <xyf.xiao [at] gmail.c=
om> =BCg=B9D=A1R

=B1H=A5=F3=A4H: Xiao Yafeng <xyf.xiao [at] gmail.com>
=A5D=C3D: Re: fork and kill process
=A6=AC=A5=F3=A4H: "Aclhk Aclhk" <aclhkaclhk [at] ymail.com>
=A4=E9=B4=C1: 2009=A6~7=A4=EB28=A4=E9,=ACP=B4=C1=A4G,=A4W=A4=C88:39

Using fork function on window is no problem. Below code spawns 10 processes=
and print in turn:
use strict;
use warnings;


my $max_process =3D 10;

my $processes =3D 0;
for my $count (1..100){
wait if $processes >=3D $max_process;
do{print $count."\n";exit} unless my $pid =3D fork;
$processes ++;
}

I roughly remember $pid of child process may not be zero on window. below o=
ne line could prove whether my guess is right or not:

perl -e 'if($pid =3D fork){print "parent pid is".$pid."\n";}else{print "chi=
ld pid is".$pid,"\n";}'




2009/7/28 Aclhk Aclhk <aclhkaclhk [at] ymail.com>
=0A=0Ai am new to writing perl in windows. I would like to achieve the same=
result from the following code:

$pid =3D fork();
defined $pid or die "fork($pid)\n";
if($pid =3D=3D 0)
{
exec("dir");
=0A}

sleep(10);
kill("TERM" =3D> $pid);

I would to spawn a process and kill it (including the child process) at lat=
er time.

Pls advise what code should be in windows environment. someone suggested wi=
n32::job but i failed to write a success code.
=0A
=0A =0A=0A=0A=0A Yahoo!=AD=BB=B4ä=B4=A3=A8=D1=BA=F4=A4W=A6w=A5=
=FE=A7=F0=B2=A4=A1A=B1=D0=A7A=A6p=A6=F3=A8=BE=BDd=B6=C2=AB=C 8!=A4F=B8=D1=A7=
=F3=A6h
_______________________________________________
=0AActivePerl mailing list
=0AActivePerl [at] listserv.ActiveState.com
=0ATo unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

=0A=0A=0A=0A Yahoo!=AD=BB=B4ä=B4=A3=A8=D1=BA=F4=A4W=A6w=A5=FE=A7=F0=
=B2=A4=A1A=B1=D0=A7A=A6p=A6=F3=A8=BE=BDd=B6=C2=AB=C8! =BD=D0=ABe=A9=B9 http=
://hk.promo.yahoo.com/security/ =A4F=B8=D1=A7=F3=A6h!
--0-682413912-1248772695=:3704
Content-Type: text/html; charset=big5
Content-Transfer-Encoding: quoted-printable

<table cellspacing=3D"0" cellpadding=3D"0" border=3D"0" ><tr><td valign=3D"=
top" style=3D"font: inherit;">fork is ok but forked process could not be ki=
lled. <br><br>--- <b>2009=A6~7=A4=EB28=A4=E9 =ACP=B4=C1=A4G=A1AXiao Yafeng =
<i><xyf.xiao [at] gmail.com></i></b> =BCg=B9D=A1R<br><blockquote style=3D"=
border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5p=
x;"><br>=B1H=A5=F3=A4H: Xiao Yafeng <xyf.xiao [at] gmail.com><br>=A5D=C3D:=
Re: fork and kill process<br>=A6=AC=A5=F3=A4H: "Aclhk Aclhk" <aclhkaclh=
k [at] ymail.com><br>=A4=E9=B4=C1: 2009=A6~7=A4=EB28=A4=E9,=ACP=B4=C1=A4G,=A4=
W=A4=C88:39<br><br><div id=3D"yiv737278429">Using fork function on window i=
s no problem. Below code spawns 10 processes and print in turn: <br><pre cl=
ass=3D"code"><tt><font><tt class=3D"codetext"><font size=3D"-1">use strict;=
<br>use warnings;<br><br><br>my $max_process =3D 10;<br><br>my $processes =
=3D 0;<br>for my $count (1..100){<br> wait if $processes >=3D $max_pr=
ocess;<br> do{print $count."\n";exit} unless my $pid =3D fork;<br>
$processes ++;<br>}<br><br>I roughly remember $pid of child process may no=
t be zero on window. below one line could prove whether my guess is right o=
r not: <br><br></font></tt></font></tt></pre>perl -e 'if($pid =3D fork){pri=
nt "parent pid is".$pid."\n";}else{print "child pid is".$pid,"\n";}'<br><br=
><br><br><br><div class=3D"gmail_quote">2009/7/28 Aclhk Aclhk <span dir=3D"=
ltr"><<a rel=3D"nofollow" ymailto=3D"mailto:aclhkaclhk [at] ymail.com" target=
=3D"_blank" href=3D"/mc/compose?to=3Daclhkaclhk [at] ymail.com">aclhkaclhk [at] ym ail=
..com</a>></span><br>=0A<blockquote class=3D"gmail_quote" style=3D"border=
-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-lef=
t: 1ex;"><table border=3D"0" cellpadding=3D"0" cellspacing=3D"0"><tbody><tr=
><td style=3D"font-family: inherit; font-style: inherit; font-variant: inhe=
rit; font-weight: inherit; font-size: inherit; line-height: inherit; font-s=
ize-adjust: inherit; font-stretch: inherit;" valign=3D"top">=0Ai am new to =
writing perl in windows. I would like to achieve the same result from the f=
ollowing code:<br><br>$pid =3D fork();<br>defined $pid or die "fork($pid)\n=
";<br>if($pid =3D=3D 0)<br>{<br>exec("<span style=3D"text-decoration: under=
line;">dir</span>");<br>=0A}<br><br>sleep(10);<br>kill("TERM" =3D> $pid)=
;<br><br>I would to spawn a process and kill it (including the child proces=
s) at later time.<br><br>Pls advise what code should be in windows environm=
ent. someone suggested win32::job but i failed to write a success code. <br=
>=0A</td></tr></tbody></table><br>=0A =0A=0A=0A=0A <hr size=3D"1"=
>Yahoo!=AD=BB=B4ä=B4=A3=A8=D1=BA=F4=A4W=A6w=A5=FE=A7=F0=B2 =A4=A1A=B1=D0=
=A7A=A6p=A6=F3=A8=BE=BDd=B6=C2=AB=C8!<a rel=3D"nofollow" target=3D"_blank" =
href=3D"http://hk.promo.yahoo.com/security/"><b>=A4F=B8=D1=A7=F3=A6h</b></a=
><br>_______________________________________________<br>=0AActivePerl maili=
ng list<br>=0A<a rel=3D"nofollow" ymailto=3D"mailto:ActivePerl [at] listserv.Act=
iveState.com" target=3D"_blank" href=3D"/mc/compose?to=3DActivePerl [at] listser=
v.ActiveState.com">ActivePerl [at] listserv.ActiveState.com</a><br>=0ATo unsubsc=
ribe: <a rel=3D"nofollow" target=3D"_blank" href=3D"http://listserv.ActiveS=
tate.com/mailman/mysubs">http://listserv.ActiveState.com/mai lman/mysubs</a>=
<br></blockquote></div><br>=0A</div></blockquote></td></tr></table><br>=0A =
=0A=0A=0A=0A <hr size=3D1>Yahoo!=AD=BB=B4ä=B4=A3=A8=D1=BA=F4=A4=
W=A6w=A5=FE=A7=F0=B2=A4=A1A=B1=D0=A7A=A6p=A6=F3=A8=BE=BDd=B6 =C2=AB=C8!<a hr=
ef=3D"http://hk.promo.yahoo.com/security/"><b>=A4F=B8=D1=A7=F3=A6h</b></a>
--0-682413912-1248772695=:3704--

--===============0746222600==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============0746222600==--
Aclhk Aclhk [ Di, 28 Juli 2009 11:18 ] [ ID #2010192 ]

Re: fork and kill process

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

Doesn't Win32::Process::KillProcess work ?

There is no such thing as a fork in Windoze, so you
basically have to create a process (possibly detached)
and you should be able to kill it be getting the pid.

_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Bill Luebkert [ Di, 28 Juli 2009 11:23 ] [ ID #2010193 ]

RE: fork and kill process

This is a multi-part message in MIME format.

--===============1809535640==
Content-Type: multipart/alternative;
boundary="----=_NextPart_000_0181_01CA0F2D.12FD1000"
Content-language: en-us

This is a multi-part message in MIME format.

------=_NextPart_000_0181_01CA0F2D.12FD1000
Content-Type: text/plain;
charset="gb2312"
Content-Transfer-Encoding: quoted-printable

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: activeperl-bounces [at] listserv.ActiveState.com =
[mailto:activeperl-bounces [at] listserv.ActiveState.com] On Behalf Of Aclhk =
Aclhk
Sent: Tuesday, July 28, 2009 2:17 AM
To: Bill Luebkert
Cc: activeperl [at] listserv.ActiveState.com
Subject: Re: fork and kill process




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

--- 2009=C4=EA7=D4=C228=C8=D5 =D0=C7=C6=DA=B6=FE=A3=ACBill Luebkert =
<dbecoll [at] roadrunner.com> =8C=91=B5=C0=A9s


=BC=C4=BC=FE=C8=CB: Bill Luebkert <dbecoll [at] roadrunner.com>
=D6=F7=EE}: Re: fork and kill process
=CA=D5=BC=FE=C8=CB: "Aclhk Aclhk" <aclhkaclhk [at] ymail.com>
=B8=B1=B1=BE(CC): activeperl [at] listserv.ActiveState.com
=C8=D5=C6=DA: =
2009=C4=EA7=D4=C228=C8=D5,=D0=C7=C6=DA=B6=FE,=C9=CF=CE=E79:1 4

Aclhk Aclhk wrote:
> i am new to writing perl in windows. I would like to achieve the same
> result from the following code:
>
> $pid =3D fork();
> defined $pid or die "fork($pid)\n";
> if($pid =3D=3D 0)
> {
> exec("dir");
> }
>
> sleep(10);
> kill("TERM" =3D> $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!=CF=E3=B8=DB=CC=E1=B9=A9=BEW=C9=CF=B0=B2=C8=AB=B9=A5=C 2=D4=A3=AC=BD=
=CC=C4=E3=C8=E7=BA=CE=B7=C0=B9=A0=BA=DA=BF=CD! =
<http://hk.promo.yahoo.com/security/> =C1=CB=BD=E2=B8ü=B6=E0


------=_NextPart_000_0181_01CA0F2D.12FD1000
Content-Type: text/html;
charset="gb2312"
Content-Transfer-Encoding: quoted-printable

<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dgb2312">
<html xmlns:v=3D"urn:schemas-microsoft-com:vml" =
xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" =
xmlns=3D"http://www.w3.org/TR/REC-html40">

<head>

<meta name=3DGenerator content=3D"Microsoft Word 12 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
..shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--
/* Font Definitions */
[at] font-face
{font-family:"MS Mincho";
panose-1:2 2 6 9 4 2 5 8 3 4;}
[at] font-face
{font-family:PMingLiU;
panose-1:2 1 6 1 0 1 1 1 1 1;}
[at] font-face
{font-family:PMingLiU;
panose-1:2 1 6 1 0 1 1 1 1 1;}
[at] font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
[at] font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
[at] font-face
{font-family:"\ [at] MS Mincho";
panose-1:2 2 6 9 4 2 5 8 3 4;}
[at] font-face
{font-family:"\ [at] PMingLiU";
panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"PMingLiU","serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
..MsoChpDefault
{mso-style-type:export-only;}
[at] page Section1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
{page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]-->
</head>

<body lang=3DEN-US link=3Dblue vlink=3Dpurple>

<div class=3DSection1>

<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>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.<o:p></o:p></span></p>

<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'><o:p> </o:p></span></p>

<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>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.<o:p></o:p></span></p>

<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'><o:p> </o:p></span></p>

<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>Cheers,<o:p></o:p></span></p>

<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>-Jan<o:p></o:p></span></p>

<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'><o:p> </o:p></span></p>

<div style=3D'border:none;border-left:solid blue 1.5pt;padding:0in 0in =
0in 4.0pt'>

<div>

<div style=3D'border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt =
0in 0in 0in'>

<p class=3DMsoNormal><b><span =
style=3D'font-size:10.0pt;font-family:"Tahoma","sans-serif"' >From:</span>=
</b><span
style=3D'font-size:10.0pt;font-family:"Tahoma","sans-serif"' >
activeperl-bounces [at] listserv.ActiveState.com
[mailto:activeperl-bounces [at] listserv.ActiveState.com] <b>On Behalf Of =
</b>Aclhk
Aclhk<br>
<b>Sent:</b> Tuesday, July 28, 2009 2:17 AM<br>
<b>To:</b> Bill Luebkert<br>
<b>Cc:</b> activeperl [at] listserv.ActiveState.com<br>
<b>Subject:</b> Re: fork and kill process<o:p></o:p></span></p>

</div>

</div>

<p class=3DMsoNormal><o:p> </o:p></p>

<table class=3DMsoNormalTable border=3D0 cellspacing=3D0 =
cellpadding=3D0>
<tr>
<td valign=3Dtop style=3D'padding:0in 0in 0in 0in'>
<p class=3DMsoNormal>if we use Win32::Process, we could not kill all =
associated
child processes.<br>
<br>
--- <b>2009<span lang=3DZH-TW>=C4=EA</span>7<span =
lang=3DZH-TW>=D4=C2</span>28<span
lang=3DZH-TW>=C8=D5 =D0=C7=C6=DA=B6=FE=A3=AC</span>Bill Luebkert =
<i><dbecoll [at] roadrunner.com></i></b>
<span lang=3DZH-TW>=8C=91=B5=C0=A9s</span><o:p></o:p></p>
<p class=3DMsoNormal style=3D'margin-bottom:12.0pt'><br>
<span lang=3DZH-TW>=BC=C4=BC=FE=C8=CB</span>: Bill Luebkert =
<dbecoll [at] roadrunner.com><br>
<span lang=3DZH-TW>=D6=F7=EE}</span>: Re: fork and kill process<br>
<span lang=3DZH-TW>=CA=D5=BC=FE=C8=CB</span>: "Aclhk Aclhk"
<aclhkaclhk [at] ymail.com><br>
<span lang=3DZH-TW>=B8=B1=B1=BE</span>(CC): =
activeperl [at] listserv.ActiveState.com<br>
<span lang=3DZH-TW>=C8=D5=C6=DA</span>: 2009<span =
lang=3DZH-TW>=C4=EA</span>7<span lang=3DZH-TW>=D4=C2</span>28<span
lang=3DZH-TW>=C8=D5</span>,<span =
lang=3DZH-TW>=D0=C7=C6=DA=B6=FE</span>,<span =
lang=3DZH-TW>=C9=CF=CE=E7</span>9:14<o:p></o:p></p>
<div>
<p class=3DMsoNormal>Aclhk Aclhk wrote:<br>
> i am new to writing perl in windows. I would like to achieve the =
same <br>
> result from the following code:<br>
> <br>
> $pid =3D fork();<br>
> defined $pid or die "fork($pid)\n";<br>
> if($pid =3D=3D 0)<br>
> {<br>
> exec("dir");<br>
> }<br>
> <br>
> sleep(10);<br>
> kill("TERM" =3D> $pid);<br>
> <br>
> I would to spawn a process and kill it (including the child =
process) at <br>
> later time.<br>
> <br>
> Pls advise what code should be in windows environment. someone =
suggested
<br>
> win32::job but i failed to write a success code.<br>
<br>
Check out Win32::Process and see if it will do what you =
need.<o:p></o:p></p>
</div>
</td>
</tr>
</table>

<p class=3DMsoNormal><span =
style=3D'font-size:10.0pt;font-family:"Calibri","sans-serif" '><o:p> =
</o:p></span></p>

<div class=3DMsoNormal align=3Dcenter style=3D'text-align:center'><span
style=3D'font-size:10.0pt;font-family:"Calibri","sans-serif" '>

<hr size=3D1 width=3D"100%" align=3Dcenter>

</span></div>

<p class=3DMsoNormal><span =
style=3D'font-size:10.0pt;font-family:"Calibri","sans-serif" '>Yahoo!</spa=
n><span
style=3D'font-size:10.0pt;font-family:"MS =
Mincho"'>=CF=E3=B8=DB=CC=E1=B9=A9=BEW=C9=CF=B0=B2=C8=AB=B9=A 5=C2=D4=A3=AC=
=BD=CC=C4=E3=C8=E7=BA=CE=B7=C0=B9=A0=BA=DA=BF=CD</span><span
style=3D'font-size:10.0pt;font-family:"Calibri","sans-serif" '>!<a
href=3D"http://hk.promo.yahoo.com/security/"><b><span =
style=3D'font-family:"MS =
Mincho"'>=C1=CB=BD=E2=B8ü=B6=E0</span></b></a><o:p></o:p></span></p>

</div>

</div>

</body>

</html>

------=_NextPart_000_0181_01CA0F2D.12FD1000--


--===============1809535640==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============1809535640==--
Jan Dubois [ Di, 28 Juli 2009 11:42 ] [ ID #2010194 ]

Re: fork and kill process

--===============0432130682==
Content-Type: multipart/alternative; boundary=00163646d4626c9970046fc370e8

--00163646d4626c9970046fc370e8
Content-Type: text/plain; charset=Big5
Content-Transfer-Encoding: quoted-printable

How do you know spawned process can not be killed? posting the code could
let us help you better.

2009/7/28 Aclhk Aclhk <aclhkaclhk [at] ymail.com>

> if we use Win32::Process, we could not kill all associated child processe=
s.
>
> --- *2009=A6~7=A4=EB28=A4=E9 =ACP=B4=C1=A4G=A1ABill Luebkert <dbecoll [at] roa=
drunner.com>* =BCg=B9D=A1R
>
>
> =B1H=A5=F3=A4H: Bill Luebkert <dbecoll [at] roadrunner.com>
> =A5D=C3D: Re: fork and kill process
> =A6=AC=A5=F3=A4H: "Aclhk Aclhk" <aclhkaclhk [at] ymail.com>
> =B0=C6=A5=BB(CC): activeperl [at] listserv.ActiveState.com
> =A4=E9=B4=C1: 2009=A6~7=A4=EB28=A4=E9,=ACP=B4=C1=A4G,=A4W=A4=C89: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 =3D fork();
> > defined $pid or die "fork($pid)\n";
> > if($pid =3D=3D 0)
> > {
> > exec("dir");
> > }
> >
> > sleep(10);
> > kill("TERM" =3D> $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 suggeste=
d
> > win32::job but i failed to write a success code.
>
> Check out Win32::Process and see if it will do what you need.
>
>
> ------------------------------
> Yahoo!=AD=BB=B4ä=B4=A3=A8=D1=BA=F4=A4W=A6w=A5=FE=A7=F0=B2= A4=A1A=B1=D0=
=A7A=A6p=A6=F3=A8=BE=BDd=B6=C2=AB=C8!*=A4F=B8=D1=A7=F3=A6h* <http://hk.prom=
o.yahoo.com/security/>
> _______________________________________________
> ActivePerl mailing list
> ActivePerl [at] listserv.ActiveState.com
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>

--00163646d4626c9970046fc370e8
Content-Type: text/html; charset=Big5
Content-Transfer-Encoding: quoted-printable

How do you know spawned process can not be killed? posting the code could l=
et us help you better. <br><br><div class=3D"gmail_quote">2009/7/28 Aclhk A=
clhk <span dir=3D"ltr"><<a href=3D"mailto:aclhkaclhk [at] ymail.com">aclhkacl=
hk [at] ymail.com</a>></span><br>
<blockquote class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, =
204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><table border=3D"=
0" cellpadding=3D"0" cellspacing=3D"0"><tbody><tr><td style=3D"font-family:=
inherit; font-style: inherit; font-variant: inherit; font-weight: inherit;=
font-size: inherit; line-height: inherit; font-size-adjust: inherit; font-=
stretch: inherit;" valign=3D"top">
if we use Win32::Process, we could not kill all associated child processes.=
<br><br>--- <b>2009=A6~7=A4=EB28=A4=E9 =ACP=B4=C1=A4G=A1ABill Luebkert <i>&=
lt;<a href=3D"mailto:dbecoll [at] roadrunner.com" target=3D"_blank">dbecoll [at] road=
runner.com</a>></i></b> =BCg=B9D=A1R<br>
<blockquote style=3D"border-left: 2px solid rgb(16, 16, 255); margin-left: =
5px; padding-left: 5px;"><br>=B1H=A5=F3=A4H: Bill Luebkert <<a href=3D"m=
ailto:dbecoll [at] roadrunner.com" target=3D"_blank">dbecoll [at] roadrunner.com</a>&=
gt;<br>=A5D=C3D: Re: fork and kill process<br>
=A6=AC=A5=F3=A4H: "Aclhk Aclhk" <<a href=3D"mailto:aclhkaclhk [at] =
ymail.com" target=3D"_blank">aclhkaclhk [at] ymail.com</a>><br>=B0=C6=A5=BB(C=
C): <a href=3D"mailto:activeperl [at] listserv.ActiveState.com" target=3D"_blank=
">activeperl [at] listserv.ActiveState.com</a><br>
=A4=E9=B4=C1: 2009=A6~7=A4=EB28=A4=E9,=ACP=B4=C1=A4G,=A4W=A4=C89:14<div cla=
ss=3D"im"><br><br><div>Aclhk Aclhk wrote:<br>> i am new to writing perl =
in windows. I would like to achieve the same <br>> result from the follo=
wing code:<br>> <br>> $pid =3D fork();<br>
> defined $pid or die "fork($pid)\n";<br>> if($pid =3D=3D 0=
)<br>> {<br>> exec("dir");<br>> }<br>> <br>>
sleep(10);<br>> kill("TERM" =3D> $pid);<br>> <br>> I=
would to spawn a process and kill it (including the child process) at <br>=
> later time.<br>> <br>> Pls advise what code should be in windows=
environment. someone suggested <br>
> win32::job but i failed to write a success code.<br><br>Check out Win3=
2::Process and see if it will do what you need.<br></div></div></blockquote=
></td></tr></tbody></table><br>




<hr size=3D"1">Yahoo!=AD=BB=B4ä=B4=A3=A8=D1=BA=F4=A4W=A6w=A5=FE=A7=
=F0=B2=A4=A1A=B1=D0=A7A=A6p=A6=F3=A8=BE=BDd=B6=C2=AB=C8!<a href=3D"http://h=
k.promo.yahoo.com/security/" target=3D"_blank"><b>=A4F=B8=D1=A7=F3=A6h</b><=
/a><br>_______________________________________________<br>
ActivePerl mailing list<br>
<a href=3D"mailto:ActivePerl [at] listserv.ActiveState.com">ActivePerl [at] listserv.=
ActiveState.com</a><br>
To unsubscribe: <a href=3D"http://listserv.ActiveState.com/mailman/mysubs" =
target=3D"_blank">http://listserv.ActiveState.com/mailman/my subs</a><br></b=
lockquote></div><br>

--00163646d4626c9970046fc370e8--

--===============0432130682==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============0432130682==--
Xiao Yafeng [ Di, 28 Juli 2009 14:45 ] [ ID #2010195 ]
Perl » gmane.comp.lang.perl.active-perl » fork and kill process

Vorheriges Thema: check wildcards within a sub
Nächstes Thema: Help with file stuff