Browse Source

Report if ExitStatus of DosBox process is non-zero

git-svn-id: trunk@39197 -
pierre 7 years ago
parent
commit
cf8c5d2540
1 changed files with 7 additions and 2 deletions
  1. 7 2
      tests/utils/dosbox/dosbox_wrapper.pas

+ 7 - 2
tests/utils/dosbox/dosbox_wrapper.pas

@@ -17,6 +17,7 @@ const
   verbose : boolean = false;
   verbose : boolean = false;
   DosBoxProcess: TProcess = nil;
   DosBoxProcess: TProcess = nil;
   dosbox_timeout : integer = 400;  { default timeout in seconds }
   dosbox_timeout : integer = 400;  { default timeout in seconds }
+  DosBoxExitStatus : integer = -1;
 var
 var
   OutputFileName : String;
   OutputFileName : String;
   SourceFileName : String;
   SourceFileName : String;
@@ -365,15 +366,18 @@ begin
     CloseFile(F);
     CloseFile(F);
   except
   except
     Writeln('Unable to read exitcode value');
     Writeln('Unable to read exitcode value');
+    if (DosBoxExitStatus <> 0) then
+      Writeln('DosBox exit status = ',DosBoxExitStatus);
     ReadExitCode:=127*256;
     ReadExitCode:=127*256;
   end;
   end;
 end;
 end;
 
 
-procedure ExecuteDosBox(const ADosBoxBinaryPath, ADosBoxDir: string);
+function ExecuteDosBox(const ADosBoxBinaryPath, ADosBoxDir: string) : Integer;
 var
 var
   Time: Integer = 0;
   Time: Integer = 0;
 begin
 begin
   DosBoxProcess := TProcess.Create(nil);
   DosBoxProcess := TProcess.Create(nil);
+  result:=-1;
   try
   try
     DosBoxProcess.Executable := ADosBoxBinaryPath;
     DosBoxProcess.Executable := ADosBoxBinaryPath;
     DosBoxProcess.Parameters.Add('-conf');
     DosBoxProcess.Parameters.Add('-conf');
@@ -394,6 +398,7 @@ begin
       Sleep(100);
       Sleep(100);
     end;
     end;
   finally
   finally
+    result:=DosBoxProcess.ExitStatus;
     DosBoxProcess.Free;
     DosBoxProcess.Free;
     DosBoxProcess:=nil;
     DosBoxProcess:=nil;
     EchoOutput;
     EchoOutput;
@@ -603,7 +608,7 @@ begin
         else if verbose then
         else if verbose then
           writeln('cwsdpmi executable missing');
           writeln('cwsdpmi executable missing');
       end;
       end;
-    ExecuteDosBox(DosBoxBinaryPath, DosBoxDir);
+    DosBoxExitStatus:=ExecuteDosBox(DosBoxBinaryPath, DosBoxDir);
   finally
   finally
     ExitProc;
     ExitProc;
   end;
   end;