mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-11 09:46:11 +02:00
+ Fixed ExecuteProcess. Now returns the exit code or raises an exception on failure
This commit is contained in:
parent
c2210f01b9
commit
d8501af1df
@ -32,6 +32,7 @@ uses
|
|||||||
{ Include platform independent interface part }
|
{ Include platform independent interface part }
|
||||||
{$i sysutilh.inc}
|
{$i sysutilh.inc}
|
||||||
|
|
||||||
|
Procedure AddDisk(const path:string);
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@ -555,13 +556,11 @@ Begin
|
|||||||
{ We're in the parent, let's wait. }
|
{ We're in the parent, let's wait. }
|
||||||
result:=WaitProcess(pid); // WaitPid and result-convert
|
result:=WaitProcess(pid); // WaitPid and result-convert
|
||||||
|
|
||||||
if (result>=0) and (result<>127) then
|
if (result<0) or (result=127) then
|
||||||
result:=0
|
|
||||||
else
|
|
||||||
begin
|
begin
|
||||||
e:=EOSError.CreateFmt(SExecuteProcessFailed,[CommandLine,result]);
|
E:=EOSError.CreateFmt(SExecuteProcessFailed,[CommandLine,result]);
|
||||||
e.ErrorCode:=result;
|
E.ErrorCode:=result;
|
||||||
raise e;
|
Raise E;
|
||||||
end;
|
end;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
@ -596,13 +595,11 @@ Begin
|
|||||||
{ We're in the parent, let's wait. }
|
{ We're in the parent, let's wait. }
|
||||||
result:=WaitProcess(pid); // WaitPid and result-convert
|
result:=WaitProcess(pid); // WaitPid and result-convert
|
||||||
|
|
||||||
if (result>=0) and (result<>127) then
|
if (result<0) or (result=127) then
|
||||||
result:=0
|
|
||||||
else
|
|
||||||
begin
|
begin
|
||||||
e:=EOSError.CreateFmt(SExecuteProcessFailed,[Path,result]);
|
E:=EOSError.CreateFmt(SExecuteProcessFailed,[Path,result]);
|
||||||
e.ErrorCode:=result;
|
E.ErrorCode:=result;
|
||||||
raise e;
|
raise E;
|
||||||
end;
|
end;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
@ -694,7 +691,10 @@ end.
|
|||||||
{
|
{
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.44 2004-08-05 07:32:51 michael
|
Revision 1.45 2004-08-30 11:13:20 michael
|
||||||
|
+ Fixed ExecuteProcess. Now returns the exit code or raises an exception on failure
|
||||||
|
|
||||||
|
Revision 1.44 2004/08/05 07:32:51 michael
|
||||||
Added getappconfig calls
|
Added getappconfig calls
|
||||||
|
|
||||||
Revision 1.43 2004/07/03 21:50:31 daniel
|
Revision 1.43 2004/07/03 21:50:31 daniel
|
||||||
|
Loading…
Reference in New Issue
Block a user