mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 16:29:24 +02:00
* WaitOnExit now returns a boolean
git-svn-id: trunk@5576 -
This commit is contained in:
parent
968f44d0b4
commit
e4fb3f71d3
@ -101,7 +101,7 @@ Type
|
|||||||
Function Resume : Integer; virtual;
|
Function Resume : Integer; virtual;
|
||||||
Function Suspend : Integer; virtual;
|
Function Suspend : Integer; virtual;
|
||||||
Function Terminate (AExitCode : Integer): Boolean; virtual;
|
Function Terminate (AExitCode : Integer): Boolean; virtual;
|
||||||
Function WaitOnExit : DWord;
|
Function WaitOnExit : Boolean;
|
||||||
Property WindowRect : Trect Read GetWindowRect Write SetWindowRect;
|
Property WindowRect : Trect Read GetWindowRect Write SetWindowRect;
|
||||||
Property Handle : THandle Read FProcessHandle;
|
Property Handle : THandle Read FProcessHandle;
|
||||||
Property ProcessHandle : THandle Read FProcessHandle;
|
Property ProcessHandle : THandle Read FProcessHandle;
|
||||||
|
@ -101,9 +101,10 @@ Function Terminate (AExitCode : Integer): Boolean; virtual;
|
|||||||
exitcode 'AExitCode'
|
exitcode 'AExitCode'
|
||||||
It returns True on succes, False on failure.
|
It returns True on succes, False on failure.
|
||||||
|
|
||||||
Function WaitOnExit : Integer;
|
Function WaitOnExit : Boolean;
|
||||||
This function returns immediatly if the application is not running,
|
This function returns true if the wait for the process exit was succesful,
|
||||||
and waits for the application to finish if it was still running.
|
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;
|
Property ApplicationName : String;
|
||||||
Sets the name of the application.
|
Sets the name of the application.
|
||||||
|
@ -340,12 +340,16 @@ begin
|
|||||||
WaitOnExit;
|
WaitOnExit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Function TProcess.WaitOnExit : Dword;
|
Function TProcess.WaitOnExit : Boolean;
|
||||||
|
|
||||||
|
Var
|
||||||
|
R : Dword;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Result:=fpWaitPid(Handle,pcint(@FExitCode),0);
|
R:=fpWaitPid(Handle,pcint(@FExitCode),0);
|
||||||
If Result=Handle then
|
Result:=(R=Handle);
|
||||||
FExitCode:=WexitStatus(FExitCode);
|
If Result then
|
||||||
|
FExitCode:=WExitStatus(FExitCode);
|
||||||
FRunning:=False;
|
FRunning:=False;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -213,11 +213,15 @@ begin
|
|||||||
WaitOnExit;
|
WaitOnExit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Function TProcess.WaitOnExit : Dword;
|
Function TProcess.WaitOnExit : Boolean;
|
||||||
|
|
||||||
|
Var
|
||||||
|
R : DWord;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Result:=WaitForSingleObject (FProcessHandle,Infinite);
|
R:=WaitForSingleObject (FProcessHandle,Infinite);
|
||||||
If Result<>Wait_Failed then
|
Result:=(R<>Wait_Failed);
|
||||||
|
If Result then
|
||||||
GetExitStatus;
|
GetExitStatus;
|
||||||
FRunning:=False;
|
FRunning:=False;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user