in reply to Need a 16 bit returncode from .exe
Here's a hackish, possible solution. From perl, invoke a small .CMD wrapper that calls the program and then echoes %ERRORLEVEL% when the command terminates.
In your perl code, assign the return from the backticks to an array. When the command completes, the return code will be the last line of that array:
The .cmd wrapper:
rem I called this errorlevel.cmd @%1 %2 %3 %4 %5 %6 %7 %8 %9 @echo %ERRORLEVEL%
An example use:
my @out = `errorlevel.cmd perl -le"print for 1 .. 10; exit 12345;"`;; print pop @out;; 12345 print join '', @out;; 1 2 3 4 5 6 7 8 9 10
|
|---|