Browse Source

* WaitOnExit now returns a boolean

git-svn-id: trunk@5576 -
michael 18 years ago
parent
commit
e4fb3f71d3
4 changed files with 20 additions and 11 deletions
  1. 1 1
      fcl/inc/process.pp
  2. 4 3
      fcl/inc/process.txt
  3. 8 4
      fcl/unix/process.inc
  4. 7 3
      fcl/win/process.inc

+ 1 - 1
fcl/inc/process.pp

@@ -101,7 +101,7 @@ Type
     Function Resume : Integer; virtual;
     Function Suspend : Integer; virtual;
     Function Terminate (AExitCode : Integer): Boolean; virtual;
-    Function WaitOnExit : DWord;
+    Function WaitOnExit : Boolean;
     Property WindowRect : Trect Read GetWindowRect Write SetWindowRect;
     Property Handle : THandle Read FProcessHandle;
     Property ProcessHandle : THandle Read FProcessHandle;

+ 4 - 3
fcl/inc/process.txt

@@ -101,9 +101,10 @@ Function Terminate (AExitCode : Integer): Boolean; virtual;
   exitcode 'AExitCode'
   It returns True on succes, False on failure.
 
-Function WaitOnExit : Integer;
-  This function returns immediatly if the application is not running,
-  and waits for the application to finish if it was still running.
+Function WaitOnExit : Boolean;
+  This function returns true if the wait for the process exit was succesful,
+  false if some error occurded. It returns immediatly if the application is 
+  not running, and waits for the application to finish if it was still running.
   
 Property ApplicationName : String;
   Sets the name of the application.

+ 8 - 4
fcl/unix/process.inc

@@ -340,12 +340,16 @@ begin
     WaitOnExit;
 end;
 
-Function TProcess.WaitOnExit : Dword;
+Function TProcess.WaitOnExit : Boolean;
+
+Var
+  R : Dword;
 
 begin
-  Result:=fpWaitPid(Handle,pcint(@FExitCode),0);
-  If Result=Handle then
-    FExitCode:=WexitStatus(FExitCode);
+  R:=fpWaitPid(Handle,pcint(@FExitCode),0);
+  Result:=(R=Handle);
+  If Result then
+    FExitCode:=WExitStatus(FExitCode);
   FRunning:=False;
 end;
 

+ 7 - 3
fcl/win/process.inc

@@ -213,11 +213,15 @@ begin
     WaitOnExit;
 end;
 
-Function TProcess.WaitOnExit : Dword;
+Function TProcess.WaitOnExit : Boolean;
+
+Var
+  R : DWord;
 
 begin
-  Result:=WaitForSingleObject (FProcessHandle,Infinite);
-  If Result<>Wait_Failed then
+  R:=WaitForSingleObject (FProcessHandle,Infinite);
+  Result:=(R<>Wait_Failed);
+  If Result then
     GetExitStatus;
   FRunning:=False;
 end;