+ Corrected some bugs if no pousepipes

This commit is contained in:
michael 2000-02-17 12:31:47 +00:00
parent aafacbb44b
commit f95b81f7ee

View File

@ -15,7 +15,8 @@ Var PName,PDir : PChar;
FProcessAttributes, FProcessAttributes,
FTHreadAttributes : TSecurityAttributes; FTHreadAttributes : TSecurityAttributes;
FProcessInformation : TProcessInformation; FProcessInformation : TProcessInformation;
status : longbool;
begin begin
FillChar(FProcessAttributes,SizeOf(FProcessAttributes),#0); FillChar(FProcessAttributes,SizeOf(FProcessAttributes),#0);
FillChar(FThreadAttributes,SizeOf(FThreadAttributes),#0); FillChar(FThreadAttributes,SizeOf(FThreadAttributes),#0);
@ -39,10 +40,13 @@ begin
end; end;
With FStartupInfo do With FStartupInfo do
begin begin
dwFlags:=FStartupInfo.dwFlags or Startf_UseStdHandles; if poUsePipes in FCreateOptions then
hStdInput:=FChildInputStream.Handle; begin
hStdOutput:=FChildOutPutStream.Handle; dwFlags:=dwFlags or Startf_UseStdHandles;
hStdError:=FChildErrorStream.Handle; hStdInput:=FChildInputStream.Handle;
hStdOutput:=FChildOutPutStream.Handle;
hStdError:=FChildErrorStream.Handle;
end;
If (FFillAttribute<>-1) then If (FFillAttribute<>-1) then
begin begin
dwFlags:=dwFlags or Startf_UseFillAttribute; dwFlags:=dwFlags or Startf_UseFillAttribute;
@ -84,14 +88,19 @@ begin
dwy:=FWindowTop; dwy:=FWindowTop;
end; end;
end; end;
Writeln ('About to start');
If FApplicationName<>'' then PName:=Pchar(FApplicationName) else PName:=Nil; If FApplicationName<>'' then PName:=Pchar(FApplicationName) else PName:=Nil;
If FCurrentDirectory<>'' then PName:=Pchar(FCurrentDirectory) else PDir:=Nil; If FCurrentDirectory<>'' then PName:=Pchar(FCurrentDirectory) else PDir:=Nil;
CreateProcess (Pname,PChar(FCommandLine),@FProcessAttributes,@FThreadAttributes, Status:=CreateProcess (Pname,PChar(FCommandLine),@FProcessAttributes,@FThreadAttributes,
FInheritHandles,FCreationFlags,FEnvironment,PDir,@FStartupInfo, FInheritHandles,FCreationFlags,FEnvironment,PDir,@FStartupInfo,
@fProcessInformation); @fProcessInformation);
Writeln ('Created ',Status);
FTHreadHandle:=fProcessInformation.hthread; FTHreadHandle:=fProcessInformation.hthread;
Writeln ('ThreadHandle :',FThreadHandle);
FHandle:=fProcessInformation.hProcess; FHandle:=fProcessInformation.hProcess;
Writeln ('Process Handle :',FHandle);
FPID:=fProcessInformation.dwProcessID; FPID:=fProcessInformation.dwProcessID;
Writeln ('Process Handle :',FPID);
FRunning:=True; FRunning:=True;
if (poWaitOnExit in FCreateOptions) and if (poWaitOnExit in FCreateOptions) and
not (poRunSuspended in FCreateOptions) then not (poRunSuspended in FCreateOptions) then