in reply to Re: Can't get Win32::Create::Process() parent to exit before it's children
in thread Can't get Win32::Create::Process() parent to exit before it's children
Here is what I tried, and it didn't work. The parent process didn't return 0, until the child process exited.This is perl, v5.8.7 built for MSWin32-x86-multi-thread Copyright 1987-2005, Larry Wall
The solution that worked is this. I went back to using Win32::Process::Create( ) but called it with the DETACHED_PROCESS creation flag set. And this worked as I wanted it to. Online.pl called Create() and then returned '0' back to my server.$ChildPID = system 1, $CMDLine; my $Lock = Glck->new($ResName); LOG_MSG("I", "Online.pl is about to exit with 0.", 52099); exit (0);
Thanks for looking into this problem for me, I hope this solution helps some of you. I am sure that I will require all of your assistance in the future ;-)require Win32::Process; my $ParentPID; $ParentPID = $$; LOG_MSG("I", "ParentPID = $ParentPID before creating child.", 5209 +9, $ParentPID); Win32::Process::Create($ChildProc, $CMD, $CMDLine, 0, DETACHED_PRO +CESS, $CWD) || LOG_MSG("E", "Could not spawn child: $!", 52099); $ChildPID = $ChildProc->GetProcessID(); LOG_MSG("I", "ChildPID = $ChildPID", 52099, $ChildPID); my $Lock = Glck->new($ResName); $Lock->lock_mk($ChildPID); LOG_MSG("I", "Online.pl is about to exit with 0.", 52099); exit (0);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Can't get Win32::Create::Process() parent to exit before it's children
by Anonymous Monk on Oct 15, 2010 at 19:10 UTC |