Nov 4, 2009, 2:45 AM
Post #1 of 3
Hello, i have a problem with open2 and open3. Open work succesfully.
Problem with open2 & open3 in WinXP.
I porting my perl script from Linux to Windows. I realize many test and dont find any problem (executing calc.exe, perl script, etc) but three days ago problem starting with one executable.
The executable is a simulation program. It read a file specifiqued in command line parameter and write output files.
I used open3:
$childpid = open3(*HIS_IN, *HIS_OUT, *HIS_ERR, $cmd, @args);
The program start and freeze quickly. ¿Sleep? ¿Waiting by syscall? i dont know.
Screen capture of the three scenarios:
1) Capture when start and blocks (open2 and open3).
$pid = open2(\*CHLD_OUT, \*CHLD_IN, 'c:\madymo70.exe');
print "EXE\n"; #this dont show
(File: block on start.jpg)
2) Capture when start correctly (open)
$pid = open(HANDLE, "|C:/madymo70.exe|");
#PROBLEM: ¡¡¡¡¡¡¡continue when program finnish!!!!!!!!
print "EL PID ES: $pid";
(File: ok when used open.jpg)
3) Win32::Process::Create work ok but ¿How could i capture stdout and stderr?.
I need start program in background while perl script continue. Perl script check if program finish and connect to database.
Somebody have an idea why it work don't fine?
(This post was edited by julmss on Nov 4, 2009, 5:54 AM)