mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 16:19:21 +02:00
* Windows specific overloads for ExecuteProcess that implements a hack for redir that exists for dos.exec too.
.. but then not using a global variable git-svn-id: trunk@14556 -
This commit is contained in:
parent
158e36b9c5
commit
0b4b9b5220
@ -60,6 +60,10 @@ function GetFileVersion(const AFileName: string): Cardinal;
|
|||||||
|
|
||||||
procedure GetFormatSettings;
|
procedure GetFormatSettings;
|
||||||
|
|
||||||
|
// OS specific versions for windows, to keep redir working
|
||||||
|
function ExecuteProcess(Const Path: AnsiString; Const ComLine: AnsiString;ExecInheritsHandles:boolean):integer;
|
||||||
|
function ExecuteProcess(Const Path: AnsiString; Const ComLine: Array of AnsiString;ExecInheritsHandles:boolean):integer;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
@ -813,7 +817,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function ExecuteProcess(Const Path: AnsiString; Const ComLine: AnsiString):integer;
|
function ExecuteProcess(Const Path: AnsiString; Const ComLine: AnsiString;ExecInheritsHandles:boolean):integer;
|
||||||
|
// win specific function
|
||||||
var
|
var
|
||||||
SI: TStartupInfo;
|
SI: TStartupInfo;
|
||||||
PI: TProcessInformation;
|
PI: TProcessInformation;
|
||||||
@ -841,7 +846,7 @@ begin
|
|||||||
CommandLine := CommandLine + #0;
|
CommandLine := CommandLine + #0;
|
||||||
|
|
||||||
if not CreateProcess(nil, pchar(CommandLine),
|
if not CreateProcess(nil, pchar(CommandLine),
|
||||||
Nil, Nil, False,$20, Nil, Nil, SI, PI) then
|
Nil, Nil, ExecInheritsHandles,$20, Nil, Nil, SI, PI) then
|
||||||
begin
|
begin
|
||||||
e:=EOSError.CreateFmt(SExecuteProcessFailed,[CommandLine,GetLastError]);
|
e:=EOSError.CreateFmt(SExecuteProcessFailed,[CommandLine,GetLastError]);
|
||||||
e.ErrorCode:=GetLastError;
|
e.ErrorCode:=GetLastError;
|
||||||
@ -865,7 +870,13 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function ExecuteProcess(Const Path: AnsiString; Const ComLine: Array of AnsiString):integer;
|
function ExecuteProcess(Const Path: AnsiString; Const ComLine: AnsiString):integer;
|
||||||
|
// os independant function
|
||||||
|
begin
|
||||||
|
result:=Executeprocess(path,comline,false);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function ExecuteProcess(Const Path: AnsiString; Const ComLine: Array of AnsiString;ExecInheritsHandles:boolean):integer;
|
||||||
|
|
||||||
var
|
var
|
||||||
CommandLine: AnsiString;
|
CommandLine: AnsiString;
|
||||||
@ -878,7 +889,13 @@ begin
|
|||||||
CommandLine := CommandLine + ' ' + '"' + ComLine [I] + '"'
|
CommandLine := CommandLine + ' ' + '"' + ComLine [I] + '"'
|
||||||
else
|
else
|
||||||
CommandLine := CommandLine + ' ' + Comline [I];
|
CommandLine := CommandLine + ' ' + Comline [I];
|
||||||
ExecuteProcess := ExecuteProcess (Path, CommandLine);
|
ExecuteProcess := ExecuteProcess (Path, CommandLine,ExecInheritsHandles);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function ExecuteProcess(Const Path: AnsiString; Const ComLine: Array of AnsiString):integer;
|
||||||
|
// os independant function
|
||||||
|
begin
|
||||||
|
result:=Executeprocess(path,comline,false);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Procedure Sleep(Milliseconds : Cardinal);
|
Procedure Sleep(Milliseconds : Cardinal);
|
||||||
|
Loading…
Reference in New Issue
Block a user