Browse Source

* make pipesize a property. Mantis #22327, patch by Cyrax.

git-svn-id: trunk@21740 -
marco 13 years ago
parent
commit
e5f0c75efe

+ 1 - 1
packages/fcl-process/src/dummy/pipes.inc

@@ -15,7 +15,7 @@
 
 
 // No pipes under dos, sorry...
 // No pipes under dos, sorry...
 
 
-Function CreatePipeHandles (Var Inhandle,OutHandle : THandle) : Boolean;
+Function CreatePipeHandles (Var Inhandle,OutHandle : THandle; APipeBufferSize : Cardinal = 1024) : Boolean;
 
 
 begin
 begin
   InHandle := THandle (UnusedHandle);
   InHandle := THandle (UnusedHandle);

+ 2 - 2
packages/fcl-process/src/os2/pipes.inc

@@ -19,10 +19,10 @@ uses
 const
 const
  PipeBufSize = 1024;
  PipeBufSize = 1024;
 
 
-Function CreatePipeHandles (Var Inhandle,OutHandle : Longint) : Boolean;
+Function CreatePipeHandles (Var Inhandle,OutHandle : Longint; APipeBufferSize : Cardinal = 1024) : Boolean;
 
 
 begin
 begin
-  CreatePipeHandles := DosCreatePipe (InHandle, OutHandle, PipeBufSize) = 0;
+  CreatePipeHandles := DosCreatePipe (InHandle, OutHandle, APipeBufferSize) = 0;
 end;
 end;
 
 
 Function TInputPipeStream.GetNumBytesAvailable: DWord;
 Function TInputPipeStream.GetNumBytesAvailable: DWord;

+ 1 - 1
packages/fcl-process/src/pipes.pp

@@ -50,7 +50,7 @@ Type
       Function Read (Var Buffer; Count : Longint) : longint; Override;
       Function Read (Var Buffer; Count : Longint) : longint; Override;
     end;
     end;
 
 
-Function CreatePipeHandles (Var Inhandle,OutHandle : THandle) : Boolean;
+Function CreatePipeHandles (Var Inhandle,OutHandle : THandle; APipeBufferSize : Cardinal = 1024) : Boolean;
 Procedure CreatePipeStreams (Var InPipe : TInputPipeStream;
 Procedure CreatePipeStreams (Var InPipe : TInputPipeStream;
                              Var OutPipe : TOutputPipeStream);
                              Var OutPipe : TOutputPipeStream);
 
 

+ 2 - 0
packages/fcl-process/src/process.pp

@@ -78,6 +78,7 @@ Type
     dwYcountChars,
     dwYcountChars,
     dwy : Cardinal;
     dwy : Cardinal;
     FXTermProgram: String;
     FXTermProgram: String;
+    FPipeBufferSize : cardinal;
     Procedure FreeStreams;
     Procedure FreeStreams;
     Function  GetExitStatus : Integer;
     Function  GetExitStatus : Integer;
     Function  GetRunning : Boolean;
     Function  GetRunning : Boolean;
@@ -134,6 +135,7 @@ Type
     property OnForkEvent : TProcessForkEvent Read FForkEvent Write FForkEvent;
     property OnForkEvent : TProcessForkEvent Read FForkEvent Write FForkEvent;
     {$endif UNIX}
     {$endif UNIX}
   Published
   Published
+    property PipeBufferSize : cardinal read FPipeBufferSize write FPipeBufferSize default 1024;
     Property Active : Boolean Read GetRunning Write SetActive;
     Property Active : Boolean Read GetRunning Write SetActive;
     Property ApplicationName : String Read FApplicationName Write SetApplicationName; deprecated;
     Property ApplicationName : String Read FApplicationName Write SetApplicationName; deprecated;
     Property CommandLine : String Read FCommandLine Write SetCommandLine ; deprecated;
     Property CommandLine : String Read FCommandLine Write SetCommandLine ; deprecated;

+ 1 - 1
packages/fcl-process/src/unix/pipes.inc

@@ -16,7 +16,7 @@
 Uses
 Uses
   BaseUnix, Unix, TermIO;
   BaseUnix, Unix, TermIO;
 
 
-Function CreatePipeHandles (Var Inhandle,OutHandle : Longint) : Boolean;
+Function CreatePipeHandles (Var Inhandle,OutHandle : Longint; APipeBufferSize : Cardinal = 1024) : Boolean;
 
 
 begin
 begin
   Result := (AssignPipe (Inhandle,OutHandle)<>-1);
   Result := (AssignPipe (Inhandle,OutHandle)<>-1);

+ 2 - 2
packages/fcl-process/src/win/pipes.inc

@@ -28,10 +28,10 @@ Const piInheritablePipe : TSecurityAttributes = (
       PipeBufSize = 1024;
       PipeBufSize = 1024;
 
 
 
 
-Function CreatePipeHandles (Var Inhandle,OutHandle : THandle) : Boolean;
+Function CreatePipeHandles (Var Inhandle,OutHandle : THandle; APipeBufferSize : Cardinal = PipeBufSize) : Boolean;
 
 
 begin
 begin
-  Result := CreatePipe (@Inhandle,@OutHandle,@piNonInheritablePipe,PipeBufSize);
+  Result := CreatePipe (@Inhandle,@OutHandle,@piNonInheritablePipe,APipeBufferSize);
 end;
 end;
 
 
 
 

+ 5 - 5
packages/fcl-process/src/win/process.inc

@@ -179,15 +179,15 @@ begin
 end;
 end;
 
 
 
 
-Procedure CreatePipes(Var HI,HO,HE : Thandle; Var SI : TStartupInfo; CE : Boolean);
+Procedure CreatePipes(Var HI,HO,HE : Thandle; Var SI : TStartupInfo; CE : Boolean; APipeBufferSize : Cardinal);
 
 
 begin
 begin
-  CreatePipeHandles(SI.hStdInput,HI);
+  CreatePipeHandles(SI.hStdInput,HI, APipeBufferSize);
   DuplicateHandleFP(SI.hStdInput);
   DuplicateHandleFP(SI.hStdInput);
-  CreatePipeHandles(HO,Si.hStdOutput);
+  CreatePipeHandles(HO,Si.hStdOutput, APipeBufferSize);
   DuplicateHandleFP(   Si.hStdOutput);
   DuplicateHandleFP(   Si.hStdOutput);
   if CE then begin
   if CE then begin
-    CreatePipeHandles(HE,SI.hStdError);
+    CreatePipeHandles(HE,SI.hStdError, APipeBufferSize);
     DuplicateHandleFP(   SI.hStdError);
     DuplicateHandleFP(   SI.hStdError);
     end
     end
   else
   else
@@ -262,7 +262,7 @@ begin
     InitThreadAttributes(Self,FThreadAttributes);
     InitThreadAttributes(Self,FThreadAttributes);
     InitStartupInfo(Self,FStartUpInfo);
     InitStartupInfo(Self,FStartUpInfo);
     If poUsePipes in FProcessOptions then
     If poUsePipes in FProcessOptions then
-      CreatePipes(HI,HO,HE,FStartupInfo,Not(poStdErrToOutPut in FProcessOptions));
+      CreatePipes(HI,HO,HE,FStartupInfo,Not(poStdErrToOutPut in FProcessOptions), FPipeBufferSize);
     Try
     Try
       If Not CreateProcess (PName,PCommandLine,@FProcessAttributes,@FThreadAttributes,
       If Not CreateProcess (PName,PCommandLine,@FProcessAttributes,@FThreadAttributes,
                    FInheritHandles,FCreationFlags,FEnv,PDir,FStartupInfo,
                    FInheritHandles,FCreationFlags,FEnv,PDir,FStartupInfo,

+ 5 - 5
packages/fcl-process/src/wince/process.inc

@@ -152,13 +152,13 @@ begin
      end;
      end;
 end;
 end;
 
 
-Procedure CreatePipes(Var HI,HO,HE : Thandle; Var SI : TStartupInfo; CE : Boolean);
+Procedure CreatePipes(Var HI,HO,HE : Thandle; Var SI : TStartupInfo; CE : Boolean; APipeBufferSize : Cardinal);
 
 
 begin
 begin
-  CreatePipeHandles(SI.hStdInput,HI);
-  CreatePipeHandles(HO,Si.hStdOutput);
+  CreatePipeHandles(SI.hStdInput,HI,APipeBufferSize);
+  CreatePipeHandles(HO,Si.hStdOutput,APipeBufferSize);
   if CE then
   if CE then
-    CreatePipeHandles(HE,SI.hStdError)
+    CreatePipeHandles(HE,SI.hStdError,APipeBufferSize)
   else
   else
     begin
     begin
     SI.hStdError:=SI.hStdOutput;
     SI.hStdError:=SI.hStdOutput;
@@ -213,7 +213,7 @@ begin
     InitThreadAttributes(Self,FThreadAttributes);
     InitThreadAttributes(Self,FThreadAttributes);
     InitStartupInfo(Self,FStartUpInfo);
     InitStartupInfo(Self,FStartUpInfo);
     If poUsePipes in FProcessOptions then
     If poUsePipes in FProcessOptions then
-      CreatePipes(HI,HO,HE,FStartupInfo,Not(poStdErrToOutPut in FProcessOptions));
+      CreatePipes(HI,HO,HE,FStartupInfo,Not(poStdErrToOutPut in FProcessOptions),FPipeBufferSize);
     Try
     Try
       If Not CreateProcess (PName,PCommandLine,@FProcessAttributes,@FThreadAttributes,
       If Not CreateProcess (PName,PCommandLine,@FProcessAttributes,@FThreadAttributes,
                    FInheritHandles,FCreationFlags,FEnv,PDir,@FStartupInfo,
                    FInheritHandles,FCreationFlags,FEnv,PDir,@FStartupInfo,