* fix executable not found exception

git-svn-id: trunk@9239 -
This commit is contained in:
peter 2007-11-13 19:23:34 +00:00
parent 80008b5146
commit e07b0ee147

View File

@ -104,9 +104,9 @@ Procedure CommandToList(S : String; List : TStrings);
end; end;
inc(wend); inc(wend);
end; end;
Result:=Copy(S,WStart,WEnd-WStart); Result:=Copy(S,WStart,WEnd-WStart);
if (Length(Result) > 0) if (Length(Result) > 0)
and (Result[1] = Result[Length(Result)]) // if 1st char = last char and.. 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 and (Result[1] in Literals) then // it's one of the literals, then
@ -248,6 +248,7 @@ Var
FEnv : PPChar; FEnv : PPChar;
Argv : PPChar; Argv : PPChar;
fd : Integer; fd : Integer;
FoundName,
PName : String; PName : String;
begin begin
@ -270,14 +271,15 @@ begin
If (PName='') then If (PName='') then
PName:=CommandLine; PName:=CommandLine;
end; 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]); raise EProcess.CreateFmt(SErrNoSuchProgram,[PName]);
end; end;
Pid:=fpfork; Pid:=fpfork;
if Pid<0 then if Pid<0 then
Raise EProcess.Create('Failed to Fork process'); Raise EProcess.Create('Failed to Fork process');
@ -302,7 +304,7 @@ begin
fpdup2(HO[peWrite],1); fpdup2(HO[peWrite],1);
if (poStdErrToOutPut in Options) then if (poStdErrToOutPut in Options) then
fpdup2(HO[peWrite],2) fpdup2(HO[peWrite],2)
else else
begin begin
fpclose(HE[peRead]); fpclose(HE[peRead]);
fpdup2(HE[peWrite],2); fpdup2(HE[peWrite],2);