Browse Source

+ Corrected some bugs if no pousepipes

michael 25 years ago
parent
commit
f95b81f7ee
1 changed files with 15 additions and 6 deletions
  1. 15 6
      fcl/win32/process.inc

+ 15 - 6
fcl/win32/process.inc

@@ -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;
-    hStdInput:=FChildInputStream.Handle;
-    hStdOutput:=FChildOutPutStream.Handle;
-    hStdError:=FChildErrorStream.Handle;
+    if poUsePipes in FCreateOptions then
+      begin
+      dwFlags:=dwFlags or Startf_UseStdHandles;
+      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