summaryrefslogtreecommitdiff
path: root/packages/fcl-process
diff options
context:
space:
mode:
authorpeter <peter@3ad0048d-3df7-0310-abae-a5850022a9f2>2007-11-13 19:23:34 +0000
committerpeter <peter@3ad0048d-3df7-0310-abae-a5850022a9f2>2007-11-13 19:23:34 +0000
commitb144dc2481dbe4e8281cd361d97bcde02a6db3fc (patch)
tree32f8a26873e488d9c507b7f69851bcadf94dc939 /packages/fcl-process
parentdd8176e7335fa8ae23f12879c842b0c97a81ccb6 (diff)
downloadfpc-b144dc2481dbe4e8281cd361d97bcde02a6db3fc.tar.gz
* fix executable not found exception
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@9239 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'packages/fcl-process')
-rw-r--r--packages/fcl-process/src/unix/process.inc18
1 files changed, 10 insertions, 8 deletions
diff --git a/packages/fcl-process/src/unix/process.inc b/packages/fcl-process/src/unix/process.inc
index f88623c959..5ae60d24c1 100644
--- a/packages/fcl-process/src/unix/process.inc
+++ b/packages/fcl-process/src/unix/process.inc
@@ -104,9 +104,9 @@ Procedure CommandToList(S : String; List : TStrings);
end;
inc(wend);
end;
-
+
Result:=Copy(S,WStart,WEnd-WStart);
-
+
if (Length(Result) > 0)
and (Result[1] = Result[Length(Result)]) // if 1st char = last char and..
and (Result[1] in Literals) then // it's one of the literals, then
@@ -248,6 +248,7 @@ Var
FEnv : PPChar;
Argv : PPChar;
fd : Integer;
+ FoundName,
PName : String;
begin
@@ -270,14 +271,15 @@ begin
If (PName='') then
PName:=CommandLine;
end;
-
- if not FileExists(PName) then begin
- PName := FileSearch(Pname,fpgetenv('PATH'));
- if Length(PName) = 0 then
+ if not FileExists(PName) then begin
+ FoundName := FileSearch(Pname,fpgetenv('PATH'));
+ if FoundName<>'' then
+ PName:=FoundName
+ else
raise EProcess.CreateFmt(SErrNoSuchProgram,[PName]);
end;
-
+
Pid:=fpfork;
if Pid<0 then
Raise EProcess.Create('Failed to Fork process');
@@ -302,7 +304,7 @@ begin
fpdup2(HO[peWrite],1);
if (poStdErrToOutPut in Options) then
fpdup2(HO[peWrite],2)
- else
+ else
begin
fpclose(HE[peRead]);
fpdup2(HE[peWrite],2);