Browse Source

* routine to transform result of fpsystem to old "shell" convention added.

git-svn-id: trunk@21341 -
marco 13 years ago
parent
commit
90adaeb652
1 changed files with 14 additions and 2 deletions
  1. 14 2
      tests/utils/redir.pp

+ 14 - 2
tests/utils/redir.pp

@@ -977,6 +977,18 @@ end;
 
 {............................................................................}
 
+function TransformfpSystemToShell(s:cint):cint;
+// transforms standarized (fp)System(3) result to the conventions of the old Unix.shell function.
+begin
+ if s=-1 then exit(-1);
+ if wifexited(s) then
+   TransformfpSystemToShell:=wexitstatus(s)
+ else if (s>0) then   
+   TransformfpSystemToShell:=-s  
+ else
+   TransformfpSystemToShell:=s;  
+end;
+
   procedure DosExecute(ProgName, ComLine : String);
 
 
@@ -987,10 +999,10 @@ end;
 {$ifdef usedos}
     SwapVectors;
 {$endif usedos}
-    { Must use shell() for linux for the wildcard expansion (PFV) }
+    { Must use shell/fpsystem() for *nix for the wildcard expansion (PFV) }
 {$ifdef UNIX}
     IOStatus:=0;
-    ExecuteResult:=fpsystem(FixPath(Progname)+' '+Comline);
+    ExecuteResult:=Transformfpsystemtoshell(fpsystem((FixPath(Progname)+' '+Comline)));
     if ExecuteResult<0 then
       begin
         IOStatus:=(-ExecuteResult) and $7f;