mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-19 23:19:24 +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,
|
||||
Baseunix;
|
||||
|
||||
|
||||
resourcestring
|
||||
SErrNoSuchProgram = 'Executable not found: "%s"';
|
||||
|
||||
Const
|
||||
PriorityConstants : Array [TProcessPriority] of Integer =
|
||||
@ -247,7 +248,7 @@ Var
|
||||
FEnv : PPChar;
|
||||
Argv : PPChar;
|
||||
fd : Integer;
|
||||
PName : String;
|
||||
PName,p2 : String;
|
||||
|
||||
begin
|
||||
If (poUsePipes in FProcessOptions) then
|
||||
@ -270,7 +271,11 @@ begin
|
||||
PName:=CommandLine;
|
||||
end;
|
||||
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;
|
||||
if Pid<0 then
|
||||
Raise EProcess.Create('Failed to Fork process');
|
||||
|
Loading…
Reference in New Issue
Block a user