RE: untethered child process

"John DePasquale" <[email protected]> Tue, 2 Aug 2016 14:02:57 -0400
Newsgroups gmane.comp.lang.perl.active-perl
Message-ID <[email protected]>
This is a multipart message in MIME format.

--===============0275062028==
Content-Type: multipart/alternative;
	boundary="----=_NextPart_000_00BF_01D1ECC6.9332BA30"
Content-language: en-us

This is a multipart message in MIME format.

------=_NextPart_000_00BF_01D1ECC6.9332BA30
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit

Thanks howard. I did try that option, as below:

 

Win32::Process::Create( $Win32processObj,

                        'e:\\programs\\dev\\batfile.bat',

                        'batfile.bat',

                         0,

                         DETACHED_PROCESS,

                         '.' ) ||  die "Failed to create process.\n";

 

Interestingly, this did not run the bat file at all ( though it did not
produce the "Failed . . . " error ). This same statement runs fine when I
use NORMAL_PRIORITY_CLASS in place of DETACHED_PROCESS, meaning that it runs
the bat file successfully. However, the parent process waits for the
win32::process to complete before control is returned to the parent. Using
DETACHED_PROCESS not only does not achieve the objective, it causes the
child process to not run at all, for some reason.

 

John DePasquale

Chief Executive Officer

Paradigm Consulting

"Proudly presenting the Vinopedia System"

www.vinopedia.us <http://www.vinopedia.us/> 

49 Dalby Street

Newton, MA  02458

Mobile: 617-610-2424

Fax: 617-600-7326

  _____  

 

From: Howard Tanner [mailto:[email protected]] 
Sent: Tuesday, August 02, 2016 1:51 PM
To: 'John DePasquale'
Subject: RE: untethered child process

 

Did you use the DETACHED_PROCESS option on the Win32::Process->Create? This
should in theory do what you want.

 

From: [email protected]
[mailto:[email protected]] On Behalf Of John
DePasquale
Sent: Tuesday, August 2, 2016 12:52 PM
To: [email protected]
Subject: untethered child process

 

Hi all,

Is it truly possible to spawn a child process in perl on windows so that the
parent process does NOT wait for the child process to finish before the
parent continues its own processing? I've tried to accomplish this over the
last couple of days using exec, system, wind32::process, proc::background,
fork, and more, on windows server 2008 using perl 5.22.1. For each of these
statements I'm able to spawn a child process that runs a .bat file
successfully, but in each case the parent waits for the .bat file to finish
processing ( it takes about 40 seconds ) before the parent proceeds. I'm
beginning to think that this is not really possible on windows. I have found
dozens of sites that detail usage of each of these statements and I've tried
them all. I can get all of them to launch and complete a child process but I
can't get the parent to NOT wait for completion.

Any guidance is very gratefully appreciated. Thank you.

-          john

 

John DePasquale

Chief Executive Officer

Paradigm Consulting

"Proudly presenting the Vinopedia System"

www.vinopedia.us <http://www.vinopedia.us/> 

49 Dalby Street

Newton, MA  02458

Mobile: 617-610-2424

Fax: 617-600-7326

  _____  

 


------=_NextPart_000_00BF_01D1ECC6.9332BA30
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<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 =
http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dus-ascii"><meta name=3DGenerator content=3D"Microsoft Word 14 =
(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 */
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
	{font-family:Tahoma;
	panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
	{font-family:Verdana;
	panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:11.0pt;
	font-family:"Calibri","sans-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;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
	{mso-style-priority:99;
	mso-style-link:"Balloon Text Char";
	margin:0in;
	margin-bottom:.0001pt;
	font-size:8.0pt;
	font-family:"Tahoma","sans-serif";}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
	{mso-style-priority:34;
	margin-top:0in;
	margin-right:0in;
	margin-bottom:0in;
	margin-left:.5in;
	margin-bottom:.0001pt;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";}
p.msonormal0, li.msonormal0, div.msonormal0
	{mso-style-name:msonormal;
	mso-margin-top-alt:auto;
	margin-right:0in;
	mso-margin-bottom-alt:auto;
	margin-left:0in;
	font-size:12.0pt;
	font-family:"Times New Roman","serif";}
span.EmailStyle19
	{mso-style-type:personal;
	font-family:"Calibri","sans-serif";
	color:windowtext;}
span.EmailStyle20
	{mso-style-type:personal;
	font-family:"Calibri","sans-serif";
	color:#1F497D;}
span.EmailStyle21
	{mso-style-type:personal;
	font-family:"Calibri","sans-serif";
	color:windowtext;}
span.EmailStyle22
	{mso-style-type:personal-reply;
	font-family:"Calibri","sans-serif";
	color:#1F497D;}
span.BalloonTextChar
	{mso-style-name:"Balloon Text Char";
	mso-style-priority:99;
	mso-style-link:"Balloon Text";
	font-family:"Tahoma","sans-serif";}
.MsoChpDefault
	{mso-style-type:export-only;
	font-size:10.0pt;}
@page WordSection1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
	{page:WordSection1;}
--></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=3DWordSection1><p class=3DMsoNormal><span =
style=3D'color:#1F497D'>Thanks howard. I did try that option, as =
below:<o:p></o:p></span></p><p class=3DMsoNormal><span =
style=3D'color:#1F497D'><o:p>&nbsp;</o:p></span></p><p =
class=3DMsoNormal><span style=3D'color:#1F497D'>Win32::Process::Create( =
$Win32processObj,<o:p></o:p></span></p><p class=3DMsoNormal><span =
style=3D'color:#1F497D'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp; =
'e:\\programs\\dev\\batfile.bat',<o:p></o:p></span></p><p =
class=3DMsoNormal><span =
style=3D'color:#1F497D'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp; 'batfile.bat',<o:p></o:p></span></p><p =
class=3DMsoNormal><span =
style=3D'color:#1F497D'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp; 0,<o:p></o:p></span></p><p =
class=3DMsoNormal><span =
style=3D'color:#1F497D'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp; DETACHED_PROCESS,<o:p></o:p></span></p><p =
class=3DMsoNormal><span =
style=3D'color:#1F497D'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp; '.' ) ||&nbsp; die &quot;Failed to create =
process.\n&quot;;<o:p></o:p></span></p><p class=3DMsoNormal><span =
style=3D'color:#1F497D'><o:p>&nbsp;</o:p></span></p><p =
class=3DMsoNormal><span style=3D'color:#1F497D'>Interestingly, this did =
not run the bat file at all ( though it did not produce the =
&#8220;Failed . . . &#8220; error ). This same statement runs fine when =
I use NORMAL_PRIORITY_CLASS in place of DETACHED_PROCESS, meaning that =
it runs the bat file successfully. However, the parent process waits for =
the win32::process to complete before control is returned to the parent. =
Using DETACHED_PROCESS not only does not achieve the objective, it =
causes the child process to not run at all, for some =
reason.<o:p></o:p></span></p><p class=3DMsoNormal><span =
style=3D'color:#1F497D'><o:p>&nbsp;</o:p></span></p><div><p =
class=3DMsoNormal><span style=3D'color:#1F497D'>John =
DePasquale<o:p></o:p></span></p><p class=3DMsoNormal><span =
style=3D'color:#1F497D'>Chief Executive Officer<o:p></o:p></span></p><p =
class=3DMsoNormal><span style=3D'color:#1F497D'>Paradigm =
Consulting<o:p></o:p></span></p><p class=3DMsoNormal><i><span =
style=3D'color:#1F497D'>&#8220;Proudly presenting the Vinopedia =
System&#8221;<o:p></o:p></span></i></p><p class=3DMsoNormal><span =
style=3D'color:#1F497D'><a =
href=3D"http://www.vinopedia.us/">www.vinopedia.us</a><o:p></o:p></span><=
/p><p class=3DMsoNormal><span style=3D'color:#1F497D'>49 Dalby =
Street<o:p></o:p></span></p><p class=3DMsoNormal><span =
style=3D'color:#1F497D'>Newton, MA&nbsp; 02458<o:p></o:p></span></p><p =
class=3DMsoNormal><span style=3D'color:#1F497D'>Mobile: =
617-610-2424<o:p></o:p></span></p><p class=3DMsoNormal><span =
style=3D'color:#1F497D'>Fax: 617-600-7326</span><span =
style=3D'font-family:"Verdana","sans-serif";color:#1F497D'><o:p></o:p></s=
pan></p><div class=3DMsoNormal align=3Dcenter =
style=3D'text-align:center'><span =
style=3D'font-family:"Verdana","sans-serif";color:#1F497D'><hr size=3D2 =
width=3D"100%" align=3Dcenter></span></div></div><p =
class=3DMsoNormal><span =
style=3D'color:#1F497D'><o:p>&nbsp;</o:p></span></p><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"'> =
Howard Tanner [mailto:[email protected]] <br><b>Sent:</b> Tuesday, =
August 02, 2016 1:51 PM<br><b>To:</b> 'John =
DePasquale'<br><b>Subject:</b> RE: untethered child =
process<o:p></o:p></span></p></div></div><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p><p class=3DMsoNormal><span =
style=3D'color:#1F497D'>Did you use the DETACHED_PROCESS option on the =
Win32::Process-&gt;Create? This should in theory do what you =
want.<o:p></o:p></span></p><p class=3DMsoNormal><span =
style=3D'color:#1F497D'><o:p>&nbsp;</o:p></span></p><div><div =
style=3D'border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in =
0in 0in'><p class=3DMsoNormal><b>From:</b> <a =
href=3D"mailto:[email protected]">activeperl-bo=
[email protected]</a> [<a =
href=3D"mailto:[email protected]">mailto:active=
[email protected]</a>] <b>On Behalf Of </b>John =
DePasquale<br><b>Sent:</b> Tuesday, August 2, 2016 12:52 =
PM<br><b>To:</b> <a =
href=3D"mailto:[email protected]">[email protected]=
ctiveState.com</a><br><b>Subject:</b> untethered child =
process<o:p></o:p></p></div></div><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p><p class=3DMsoNormal>Hi =
all,<o:p></o:p></p><p class=3DMsoNormal>Is it truly possible to spawn a =
child process in perl on windows so that the parent process does NOT =
wait for the child process to finish before the parent continues its own =
processing? I&#8217;ve tried to accomplish this over the last couple of =
days using exec, system, wind32::process, proc::background, fork, and =
more, on windows server 2008 using perl 5.22.1. For each of these =
statements I&#8217;m able to spawn a child process that runs a .bat file =
successfully, but in each case the parent waits for the .bat file to =
finish processing ( it takes about 40 seconds ) before the parent =
proceeds. I&#8217;m beginning to think that this is not really possible =
on windows. I have found dozens of sites that detail usage of each of =
these statements and I&#8217;ve tried them all. I can get all of them to =
launch and complete a child process but I can&#8217;t get the parent to =
NOT wait for completion.<o:p></o:p></p><p class=3DMsoNormal>Any guidance =
is very gratefully appreciated. Thank you.<o:p></o:p></p><p =
class=3DMsoListParagraph style=3D'text-indent:-.25in'>-<span =
style=3D'font-size:7.0pt;font-family:"Times New =
Roman","serif"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</span>john<o:p></o:p></p><p class=3DMsoNormal><o:p>&nbsp;</o:p></p><p =
class=3DMsoNormal><span style=3D'color:#1F497D'>John =
DePasquale<o:p></o:p></span></p><p class=3DMsoNormal><span =
style=3D'color:#1F497D'>Chief Executive Officer<o:p></o:p></span></p><p =
class=3DMsoNormal><span style=3D'color:#1F497D'>Paradigm =
Consulting<o:p></o:p></span></p><p class=3DMsoNormal><i><span =
style=3D'color:#1F497D'>&#8220;Proudly presenting the Vinopedia =
System&#8221;<o:p></o:p></span></i></p><p class=3DMsoNormal><a =
href=3D"http://www.vinopedia.us/">www.vinopedia.us</a><o:p></o:p></p><p =
class=3DMsoNormal><span style=3D'color:#1F497D'>49 Dalby =
Street<o:p></o:p></span></p><p class=3DMsoNormal><span =
style=3D'color:#1F497D'>Newton, MA&nbsp; 02458<o:p></o:p></span></p><p =
class=3DMsoNormal><span style=3D'color:#1F497D'>Mobile: =
617-610-2424<o:p></o:p></span></p><p class=3DMsoNormal><span =
style=3D'color:#1F497D'>Fax: 617-600-7326</span><span =
style=3D'font-family:"Verdana","sans-serif";color:#1F497D'><o:p></o:p></s=
pan></p><div class=3DMsoNormal align=3Dcenter =
style=3D'text-align:center'><span =
style=3D'font-family:"Verdana","sans-serif";color:#1F497D'><hr size=3D2 =
width=3D"100%" align=3Dcenter></span></div><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p></div></body></html>
------=_NextPart_000_00BF_01D1ECC6.9332BA30--


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

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