mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-21 12:49:33 +02:00
* Remove some hints/warnings, add extra check for poStdErrToOutPut
This commit is contained in:
parent
3165409337
commit
84e230f6e5
@ -115,21 +115,21 @@ begin
|
||||
CopyMemory(Result, @EnvBlock[1], Length(EnvBlock)*2);
|
||||
end;
|
||||
|
||||
Procedure InitProcessAttributes(P : TProcess; Var PA : TSecurityAttributes);
|
||||
Procedure InitProcessAttributes(P : TProcess; Out PA : TSecurityAttributes);
|
||||
|
||||
begin
|
||||
FillChar(PA,SizeOf(PA),0);
|
||||
PA.nLength := SizeOf(PA);
|
||||
end;
|
||||
|
||||
Procedure InitThreadAttributes(P : TProcess; Var TA : TSecurityAttributes);
|
||||
Procedure InitThreadAttributes(P : TProcess; Out TA : TSecurityAttributes);
|
||||
|
||||
begin
|
||||
FillChar(TA,SizeOf(TA),0);
|
||||
TA.nLength := SizeOf(TA);
|
||||
end;
|
||||
|
||||
Procedure InitStartupInfo(P : TProcess; AllDescriptorsDefault: Boolean; Var SI : STARTUPINFOW);
|
||||
Procedure InitStartupInfo(P : TProcess; AllDescriptorsDefault: Boolean; Out SI : STARTUPINFOW);
|
||||
|
||||
Const
|
||||
SWC : Array [TShowWindowOptions] of Cardinal =
|
||||
@ -180,18 +180,20 @@ Var
|
||||
FThreadAttributes : TSecurityAttributes;
|
||||
FProcessInformation : TProcessInformation;
|
||||
FStartupInfo : STARTUPINFOW;
|
||||
HI,HO,HE : THandle;
|
||||
Cmd : TProcessString;
|
||||
AllDescriptorsDefault: Boolean;
|
||||
|
||||
begin
|
||||
fProcessInformation:=default(TProcessInformation);
|
||||
AllDescriptorsDefault :=
|
||||
(FDescriptors[phtInput].IOType = iotDefault) and
|
||||
(FDescriptors[phtOutput].IOType = iotDefault) and
|
||||
(FDescriptors[phtError].IOType = iotDefault);
|
||||
(FDescriptors[phtError].IOType = iotDefault) and
|
||||
not (poStdErrToOutput in Options);
|
||||
FDescriptors[phtInput].PrepareHandles;
|
||||
FDescriptors[phtOutput].PrepareHandles;
|
||||
FDescriptors[phtError].PrepareHandles;
|
||||
if not (poStdErrToOutput in Options) then
|
||||
FDescriptors[phtError].PrepareHandles;
|
||||
WName:='';
|
||||
WCommandLine:='';
|
||||
WDir:='';
|
||||
@ -248,7 +250,8 @@ Var
|
||||
Finally
|
||||
FDescriptors[phtInput].CloseTheirHandle;
|
||||
FDescriptors[phtOutput].CloseTheirHandle;
|
||||
FDescriptors[phtError].CloseTheirHandle;
|
||||
if Not(poStdErrToOutPut in Options) then
|
||||
FDescriptors[phtError].CloseTheirHandle;
|
||||
end;
|
||||
FRunning:=True;
|
||||
Finally
|
||||
@ -314,17 +317,15 @@ end;
|
||||
Function TIODescriptor.SysCreateFileNameHandle(const aFileName: string) : THandle;
|
||||
|
||||
const
|
||||
DefaultRights = 438; // 438 = 666 octal which is rw rw rw
|
||||
ModeNames : Array[Boolean] of String = ('Reading','Writing');
|
||||
|
||||
var
|
||||
FM : Integer;
|
||||
Sec: SECURITY_ATTRIBUTES;
|
||||
|
||||
begin
|
||||
if (aFileName='') then
|
||||
Raise EProcess.Create('No filename set');
|
||||
FillByte(sec, SizeOf(sec), 0);
|
||||
Sec:=Default(SECURITY_ATTRIBUTES);
|
||||
sec.nLength := SizeOf(Sec);
|
||||
sec.bInheritHandle := True;
|
||||
case ProcessHandleType of
|
||||
|
Loading…
Reference in New Issue
Block a user