in reply to Re^2: Win32 limit to number of calls to system()?
in thread Win32 limit to number of calls to system()?
Either of these will work:
As cmd.exe returns immediately and the synchronous system gathers its exit code, it avoids the accumulation of zombies and the WaitForMultipleObjects() problem:
for ( 1 .. 100 ) { print "spawning job $_"; system 'start \\Windows\\system32\\notepad.exe'; my $wid = WaitWindow( 'Notepad', 1 ); SetForegroundWindow( $wid ); SendKeys( '%{F4}' ); }
Use waitpid to gather the exit code thus avoiding the accumulation of the zombies:
for ( 1 .. 100 ) { print "spawning job $_"; my $pid = system 1, '/Windows/system32/notepad.exe'; my $wid = WaitWindow( 'Notepad', 1 ); SetForegroundWindow( $wid ); SendKeys( '%{F4}' ); waitpid $pid, 1; }
Finally, 'Simpo PDF to Text' has a 'batch mode' which would be possible -- if awkward -- to drive programmically, but it might be substantially more efficient.
I guess you've already looked at command line driven alternatives?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Win32 limit to number of calls to system()?
by Limbic~Region (Chancellor) on Sep 13, 2011 at 17:10 UTC |