mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 11:45:32 +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);
|
CopyMemory(Result, @EnvBlock[1], Length(EnvBlock)*2);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Procedure InitProcessAttributes(P : TProcess; Var PA : TSecurityAttributes);
|
Procedure InitProcessAttributes(P : TProcess; Out PA : TSecurityAttributes);
|
||||||
|
|
||||||
begin
|
begin
|
||||||
FillChar(PA,SizeOf(PA),0);
|
FillChar(PA,SizeOf(PA),0);
|
||||||
PA.nLength := SizeOf(PA);
|
PA.nLength := SizeOf(PA);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Procedure InitThreadAttributes(P : TProcess; Var TA : TSecurityAttributes);
|
Procedure InitThreadAttributes(P : TProcess; Out TA : TSecurityAttributes);
|
||||||
|
|
||||||
begin
|
begin
|
||||||
FillChar(TA,SizeOf(TA),0);
|
FillChar(TA,SizeOf(TA),0);
|
||||||
TA.nLength := SizeOf(TA);
|
TA.nLength := SizeOf(TA);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Procedure InitStartupInfo(P : TProcess; AllDescriptorsDefault: Boolean; Var SI : STARTUPINFOW);
|
Procedure InitStartupInfo(P : TProcess; AllDescriptorsDefault: Boolean; Out SI : STARTUPINFOW);
|
||||||
|
|
||||||
Const
|
Const
|
||||||
SWC : Array [TShowWindowOptions] of Cardinal =
|
SWC : Array [TShowWindowOptions] of Cardinal =
|
||||||
@ -180,17 +180,19 @@ Var
|
|||||||
FThreadAttributes : TSecurityAttributes;
|
FThreadAttributes : TSecurityAttributes;
|
||||||
FProcessInformation : TProcessInformation;
|
FProcessInformation : TProcessInformation;
|
||||||
FStartupInfo : STARTUPINFOW;
|
FStartupInfo : STARTUPINFOW;
|
||||||
HI,HO,HE : THandle;
|
|
||||||
Cmd : TProcessString;
|
Cmd : TProcessString;
|
||||||
AllDescriptorsDefault: Boolean;
|
AllDescriptorsDefault: Boolean;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
fProcessInformation:=default(TProcessInformation);
|
||||||
AllDescriptorsDefault :=
|
AllDescriptorsDefault :=
|
||||||
(FDescriptors[phtInput].IOType = iotDefault) and
|
(FDescriptors[phtInput].IOType = iotDefault) and
|
||||||
(FDescriptors[phtOutput].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[phtInput].PrepareHandles;
|
||||||
FDescriptors[phtOutput].PrepareHandles;
|
FDescriptors[phtOutput].PrepareHandles;
|
||||||
|
if not (poStdErrToOutput in Options) then
|
||||||
FDescriptors[phtError].PrepareHandles;
|
FDescriptors[phtError].PrepareHandles;
|
||||||
WName:='';
|
WName:='';
|
||||||
WCommandLine:='';
|
WCommandLine:='';
|
||||||
@ -248,6 +250,7 @@ Var
|
|||||||
Finally
|
Finally
|
||||||
FDescriptors[phtInput].CloseTheirHandle;
|
FDescriptors[phtInput].CloseTheirHandle;
|
||||||
FDescriptors[phtOutput].CloseTheirHandle;
|
FDescriptors[phtOutput].CloseTheirHandle;
|
||||||
|
if Not(poStdErrToOutPut in Options) then
|
||||||
FDescriptors[phtError].CloseTheirHandle;
|
FDescriptors[phtError].CloseTheirHandle;
|
||||||
end;
|
end;
|
||||||
FRunning:=True;
|
FRunning:=True;
|
||||||
@ -314,17 +317,15 @@ end;
|
|||||||
Function TIODescriptor.SysCreateFileNameHandle(const aFileName: string) : THandle;
|
Function TIODescriptor.SysCreateFileNameHandle(const aFileName: string) : THandle;
|
||||||
|
|
||||||
const
|
const
|
||||||
DefaultRights = 438; // 438 = 666 octal which is rw rw rw
|
|
||||||
ModeNames : Array[Boolean] of String = ('Reading','Writing');
|
ModeNames : Array[Boolean] of String = ('Reading','Writing');
|
||||||
|
|
||||||
var
|
var
|
||||||
FM : Integer;
|
|
||||||
Sec: SECURITY_ATTRIBUTES;
|
Sec: SECURITY_ATTRIBUTES;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if (aFileName='') then
|
if (aFileName='') then
|
||||||
Raise EProcess.Create('No filename set');
|
Raise EProcess.Create('No filename set');
|
||||||
FillByte(sec, SizeOf(sec), 0);
|
Sec:=Default(SECURITY_ATTRIBUTES);
|
||||||
sec.nLength := SizeOf(Sec);
|
sec.nLength := SizeOf(Sec);
|
||||||
sec.bInheritHandle := True;
|
sec.bInheritHandle := True;
|
||||||
case ProcessHandleType of
|
case ProcessHandleType of
|
||||||
|
Loading…
Reference in New Issue
Block a user