Re: Win32::Process question
From: [EMAIL PROTECTED] > I'm hoping someone has done this before. I need to spawn 3 processes > and then wait for all three to finish. > > spawn like this: > my $obj; > my $appname = $perl; > my $cmdline = "$deliverscript $arg"; > my $iflags = 1; > my $cflags = CREATE_NEW_CONSOLE | NORMAL_PRIORITY_CLASS; > my $curdir = $localdir{$filetype}; > > my $Result1 = Win32::Process::Create( > $obj1,$appname,$cmdline,$iflags,$cflags,$curdir ); > my $Result2 = Win32::Process::Create( > $obj2,$appname,$cmdline,$iflags,$cflags,$curdir ); > my $Result3 = Win32::Process::Create( > $obj3,$appname,$cmdline,$iflags,$cflags,$curdir ); > > but how can I tell when all three are finished? If I use > $obj1->Wait(INFINITE); > $obj2->Wait(INFINITE); > $obj3->Wait(INFINITE); > > what happens if $obj2 finishes before $obj1? Why don't you try it? Start three notepads and try to close them in different orders. > is there a way to check and see if a process ($obj1,$obj2,$obj3) is > still running? The $ProcessObj->GetExitCode($ex); seems to set $ex to 259 if the process is still running. Jenda = [EMAIL PROTECTED] === http://Jenda.Krynicky.cz = When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
FW: Win32::Process question
>but how can I tell when all three are finished? If I use > $obj1->Wait(INFINITE); > $obj2->Wait(INFINITE); > $obj3->Wait(INFINITE); > >what happens if $obj2 finishes before $obj1? looks like this works fine... PHF -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Win32::Process question
Hi All, I'm hoping someone has done this before. I need to spawn 3 processes and then wait for all three to finish. spawn like this: my $obj; my $appname = $perl; my $cmdline = "$deliverscript $arg"; my $iflags = 1; my $cflags = CREATE_NEW_CONSOLE | NORMAL_PRIORITY_CLASS; my $curdir = $localdir{$filetype}; my $Result1 = Win32::Process::Create( $obj1,$appname,$cmdline,$iflags,$cflags,$curdir ); my $Result2 = Win32::Process::Create( $obj2,$appname,$cmdline,$iflags,$cflags,$curdir ); my $Result3 = Win32::Process::Create( $obj3,$appname,$cmdline,$iflags,$cflags,$curdir ); but how can I tell when all three are finished? If I use $obj1->Wait(INFINITE); $obj2->Wait(INFINITE); $obj3->Wait(INFINITE); what happens if $obj2 finishes before $obj1? is there a way to check and see if a process ($obj1,$obj2,$obj3) is still running? Then I could try something like: while (1){ if ($obj->status and $obj->status and $obj->status) {last;} sleep (.2); } TIA, Peter -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]