File 1: test1.cmd
exit /b 7
file 2 exectest.pas
{$mode delphi}
uses process ;
var ex : integer;
outp:string;
begin
writeln(Runcommandindir('.','cmd.exe',['/c','test1.cmd'],outp,ex)); // returns 0 on success execution, -1 otherwise
writeln(ex); // prints exitstatus.
end.
prints
0
7
If I change the code in test.cmd to "8" and rerun, I get 0 8
So what is exactly the problem?