mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-10 04:06:09 +02:00
Avoid wrong exitcode 512 of Grep for Unix
git-svn-id: trunk@19843 -
This commit is contained in:
parent
bbc196ac02
commit
c25a96bd37
@ -791,16 +791,24 @@ end;
|
|||||||
var
|
var
|
||||||
StoreInherit : BOOL;
|
StoreInherit : BOOL;
|
||||||
{$endif Windows}
|
{$endif Windows}
|
||||||
|
{$ifdef UNIX}
|
||||||
|
var
|
||||||
|
s : cint;
|
||||||
|
{$endif}
|
||||||
Begin
|
Begin
|
||||||
SwapVectors;
|
SwapVectors;
|
||||||
{$ifdef UNIX}
|
{$ifdef UNIX}
|
||||||
IOStatus:=0;
|
IOStatus:=0;
|
||||||
{We need to use fpsystem to get wildcard expansion and avoid being
|
{We need to use fpsystem to get wildcard expansion and avoid being
|
||||||
interrupted by ctrl+c (SIGINT).};
|
interrupted by ctrl+c (SIGINT).
|
||||||
ExecuteResult:=fpsystem(MaybeQuoted(FixPath(Progname))+' '+Comline);
|
But used wifexited and wexitstatus functions
|
||||||
if ExecuteResult<0 then
|
to correctly interpret fpsystem reutrn value }
|
||||||
|
s:=fpsystem(MaybeQuoted(FixPath(Progname))+' '+Comline);
|
||||||
|
if wifexited(s) then
|
||||||
|
ExecuteResult:=wexitstatus(s)
|
||||||
|
else
|
||||||
begin
|
begin
|
||||||
|
ExecuteResult:=word(s);
|
||||||
IOStatus:=(-ExecuteResult) and $7f;
|
IOStatus:=(-ExecuteResult) and $7f;
|
||||||
ExecuteResult:=((-ExecuteResult) and $ff00) shr 8;
|
ExecuteResult:=((-ExecuteResult) and $ff00) shr 8;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user