From c25a96bd37258e405e203d49e13ba4ea16615a31 Mon Sep 17 00:00:00 2001 From: pierre Date: Tue, 13 Dec 2011 16:33:44 +0000 Subject: [PATCH] Avoid wrong exitcode 512 of Grep for Unix git-svn-id: trunk@19843 - --- ide/fpredir.pas | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/ide/fpredir.pas b/ide/fpredir.pas index a257272d0f..a553911d33 100644 --- a/ide/fpredir.pas +++ b/ide/fpredir.pas @@ -791,16 +791,24 @@ end; var StoreInherit : BOOL; {$endif Windows} - +{$ifdef UNIX} + var + s : cint; +{$endif} Begin SwapVectors; {$ifdef UNIX} IOStatus:=0; {We need to use fpsystem to get wildcard expansion and avoid being - interrupted by ctrl+c (SIGINT).}; - ExecuteResult:=fpsystem(MaybeQuoted(FixPath(Progname))+' '+Comline); - if ExecuteResult<0 then + interrupted by ctrl+c (SIGINT). + But used wifexited and wexitstatus functions + to correctly interpret fpsystem reutrn value } + s:=fpsystem(MaybeQuoted(FixPath(Progname))+' '+Comline); + if wifexited(s) then + ExecuteResult:=wexitstatus(s) + else begin + ExecuteResult:=word(s); IOStatus:=(-ExecuteResult) and $7f; ExecuteResult:=((-ExecuteResult) and $ff00) shr 8; end;