somuchh8 has asked for the wisdom of the Perl Monks concerning the following question:
Here is what I am doing, I need to launch a separate process which basically just launches a another perl script (.pl not .pm ) to do some transaction based actions in the background while my 'parent' process checks the PID of the child to determine if the execution has finished. This also works to update the 'completion bar' from 0% -> 100% so that the user can see keep track of the progress of the transaction. All this code is existing I've just picked this project up recently so I don't want to do a complete rewrite.
What the application was using previously was the Win32::Spawn module to create the process and basically "fork" returning the PID of the child so that the parent can keep track of the childs progress. However, I've had to add the ability of the child process to execute an external binary and the process that is created by Win32::Spawn does not have the ability to run embedded processes. I've tried everything, exec(), system(), `myexe.exe -args` and nothing works. Trust me, I've even tried simple things like running an helloworld binary from the child process created with Win32::Spawn and it does not run. So far this is what I have used to create my process with Win32::Process
Win32::Process::Create($saSyncPL,"${^X}","$cmdline ${optfile}",0,NORMA +L_PRIORITY_CLASS,"." ) || die "Failed to create commit / sync process + ${^X} ${cmdline}"; $pid=$saSyncPL->GetProcessID(); Log::AvLog("high", "PID = $pid", $Log::LOG_CALLER_NAME);
It looks like my parent is waiting for the child process to finish before it's moving on to other execution. I do not see my "PID = <process id of the child>" being outputted in the log file. Does anyone know what I can do so that this process will launch in the 'background' so to speak? So that my parent will execute in parallel to the child process?
Any and all help is appreciated. Thanks!
Andy
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Win32::Process - need help from an expert!
by ikegami (Patriarch) on Sep 13, 2007 at 15:36 UTC | |
|
Re: Win32::Process - need help from an expert!
by cdarke (Prior) on Sep 13, 2007 at 14:42 UTC | |
by somuchh8 (Novice) on Sep 13, 2007 at 14:45 UTC | |
by cdarke (Prior) on Sep 13, 2007 at 14:48 UTC | |
by somuchh8 (Novice) on Sep 13, 2007 at 14:55 UTC | |
by ikegami (Patriarch) on Sep 13, 2007 at 15:06 UTC | |
| |
|
Re: Win32::Process - need help from an expert!
by ikegami (Patriarch) on Sep 13, 2007 at 15:12 UTC | |
by somuchh8 (Novice) on Sep 13, 2007 at 15:25 UTC |