mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-11 19:05:54 +02:00
* Added check for existing program file. Exception is raised if it is not found
git-svn-id: trunk@5599 -
This commit is contained in:
parent
eaafd7db81
commit
bd9ee4dc83
@ -6,7 +6,8 @@ uses
|
|||||||
Unix,
|
Unix,
|
||||||
Baseunix;
|
Baseunix;
|
||||||
|
|
||||||
|
resourcestring
|
||||||
|
SErrNoSuchProgram = 'Executable not found: "%s"';
|
||||||
|
|
||||||
Const
|
Const
|
||||||
PriorityConstants : Array [TProcessPriority] of Integer =
|
PriorityConstants : Array [TProcessPriority] of Integer =
|
||||||
@ -247,7 +248,7 @@ Var
|
|||||||
FEnv : PPChar;
|
FEnv : PPChar;
|
||||||
Argv : PPChar;
|
Argv : PPChar;
|
||||||
fd : Integer;
|
fd : Integer;
|
||||||
PName : String;
|
PName,p2 : String;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
If (poUsePipes in FProcessOptions) then
|
If (poUsePipes in FProcessOptions) then
|
||||||
@ -270,7 +271,11 @@ begin
|
|||||||
PName:=CommandLine;
|
PName:=CommandLine;
|
||||||
end;
|
end;
|
||||||
if (pos('/',PName)<>1) then
|
if (pos('/',PName)<>1) then
|
||||||
PName:=FileSearch(Pname,fpgetenv('PATH'));
|
P2:=FileSearch(Pname,fpgetenv('PATH'));
|
||||||
|
If (P2='') then
|
||||||
|
Raise EProcess.CreateFmt(SErrNoSuchProgram,[PName])
|
||||||
|
else
|
||||||
|
PName:=P2;
|
||||||
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');
|
||||||
|
Loading…
Reference in New Issue
Block a user