Browse Source

--- Merging r19652 into '.':
U packages/fcl-process/src/os2/pipes.inc
U packages/fcl-process/src/unix/pipes.inc
U packages/fcl-process/src/dummy/pipes.inc
U packages/fcl-process/src/process.pp
U packages/fcl-process/src/win/pipes.inc
U packages/fcl-process/src/pipes.pp
--- Merging r19653 into '.':
G packages/fcl-process/src/pipes.pp
--- Merging r19655 into '.':
U packages/fcl-process/src/simpleipc.pp

# revisions: 19652,19653,19655
------------------------------------------------------------------------
r19652 | hajny | 2011-11-18 23:47:06 +0100 (Fri, 18 Nov 2011) | 1 line
Changed paths:
M /trunk/packages/fcl-process/src/dummy/pipes.inc
M /trunk/packages/fcl-process/src/os2/pipes.inc
M /trunk/packages/fcl-process/src/pipes.pp
M /trunk/packages/fcl-process/src/process.pp
M /trunk/packages/fcl-process/src/unix/pipes.inc
M /trunk/packages/fcl-process/src/win/pipes.inc

* TIn/OutputPipeStream gets closed on freeing
------------------------------------------------------------------------
------------------------------------------------------------------------
r19653 | marco | 2011-11-19 12:49:59 +0100 (Sat, 19 Nov 2011) | 2 lines
Changed paths:
M /trunk/packages/fcl-process/src/pipes.pp

* fixed closepipe<>pipeclose and handle<>fhandle typos reported by Jonas.

------------------------------------------------------------------------
------------------------------------------------------------------------
r19655 | hajny | 2011-11-19 13:32:32 +0100 (Sat, 19 Nov 2011) | 1 line
Changed paths:
M /trunk/packages/fcl-process/src/simpleipc.pp

* UNDEFINE corrected to UNDEF
------------------------------------------------------------------------

git-svn-id: branches/fixes_2_6@20591 -

marco 13 years ago
parent
commit
ffe91928d6

+ 8 - 0
packages/fcl-process/src/dummy/pipes.inc

@@ -18,6 +18,8 @@
 Function CreatePipeHandles (Var Inhandle,OutHandle : THandle) : Boolean;
 Function CreatePipeHandles (Var Inhandle,OutHandle : THandle) : Boolean;
 
 
 begin
 begin
+  InHandle := THandle (UnusedHandle);
+  OutHandle := THandle (UnusedHandle);
   Result := False;
   Result := False;
 end;
 end;
 
 
@@ -37,3 +39,9 @@ procedure TInputPipeStream.InvalidSeek;
 begin
 begin
   Raise EPipeSeek.Create (ENoSeekMsg);
   Raise EPipeSeek.Create (ENoSeekMsg);
 end;
 end;
+
+procedure PipeClose (const FHandle: THandle); inline;
+begin
+  if FHandle <> UnusedHandle then
+   FileClose (FHandle);
+end;

+ 4 - 0
packages/fcl-process/src/os2/pipes.inc

@@ -42,3 +42,7 @@ begin
   Raise EPipeSeek.Create (ENoSeekMsg);
   Raise EPipeSeek.Create (ENoSeekMsg);
 end;
 end;
 
 
+procedure PipeClose (const FHandle: THandle); inline;
+begin
+  FileClose(FHandle);
+end;

+ 12 - 0
packages/fcl-process/src/pipes.pp

@@ -36,6 +36,7 @@ Type
       function GetPosition: Int64; override;
       function GetPosition: Int64; override;
       procedure InvalidSeek; override;
       procedure InvalidSeek; override;
     public
     public
+      destructor Destroy; override;
       Function Write (Const Buffer; Count : Longint) :Longint; Override;
       Function Write (Const Buffer; Count : Longint) :Longint; Override;
       function Seek(const Offset: int64; Origin: TSeekOrigin): int64; override;
       function Seek(const Offset: int64; Origin: TSeekOrigin): int64; override;
       Function Read (Var Buffer; Count : Longint) : longint; Override;
       Function Read (Var Buffer; Count : Longint) : longint; Override;
@@ -44,6 +45,7 @@ Type
 
 
   TOutputPipeStream = Class(THandleStream)
   TOutputPipeStream = Class(THandleStream)
     Public
     Public
+      destructor Destroy; override;
       function Seek(const Offset: int64; Origin: TSeekOrigin): int64; override;
       function Seek(const Offset: int64; Origin: TSeekOrigin): int64; override;
       Function Read (Var Buffer; Count : Longint) : longint; Override;
       Function Read (Var Buffer; Count : Longint) : longint; Override;
     end;
     end;
@@ -75,6 +77,11 @@ begin
     Raise EPipeCreation.Create (EPipeMsg)
     Raise EPipeCreation.Create (EPipeMsg)
 end;
 end;
 
 
+destructor TInputPipeStream.Destroy;
+begin
+  PipeClose (Handle);
+end;
+
 Function TInputPipeStream.Write (Const Buffer; Count : Longint) : longint;
 Function TInputPipeStream.Write (Const Buffer; Count : Longint) : longint;
 
 
 begin
 begin
@@ -100,6 +107,11 @@ begin
   Result:=FPos;
   Result:=FPos;
 end;
 end;
 
 
+destructor TOutputPipeStream.Destroy;
+begin
+  PipeClose (Handle);
+end;
+
 Function TOutputPipeStream.Read(Var Buffer; Count : Longint) : longint;
 Function TOutputPipeStream.Read(Var Buffer; Count : Longint) : longint;
 
 
 begin
 begin

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

@@ -293,7 +293,6 @@ end;
 procedure TProcess.FreeStream(var AStream: THandleStream);
 procedure TProcess.FreeStream(var AStream: THandleStream);
 begin
 begin
   if AStream = nil then exit;
   if AStream = nil then exit;
-  FileClose(AStream.Handle);
   FreeAndNil(AStream);
   FreeAndNil(AStream);
 end;
 end;
 
 

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

@@ -181,7 +181,7 @@ implementation
   call IPCInit and IPCDone in the initialization/finalization code.
   call IPCInit and IPCDone in the initialization/finalization code.
   
   
   --------------------------------------------------------------------- }
   --------------------------------------------------------------------- }
-{$UNDEFINE OSNEEDIPCINITDONE}
+{$UNDEF OSNEEDIPCINITDONE}
 
 
 {$i simpleipc.inc}
 {$i simpleipc.inc}
 
 

+ 4 - 0
packages/fcl-process/src/unix/pipes.inc

@@ -40,3 +40,7 @@ begin
   Raise EPipeSeek.Create (ENoSeekMsg);
   Raise EPipeSeek.Create (ENoSeekMsg);
 end;
 end;
 
 
+procedure PipeClose (const FHandle: THandle); inline;
+begin
+  FileClose(FHandle);
+end;

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

@@ -50,3 +50,8 @@ procedure TInputPipeStream.InvalidSeek;
 begin
 begin
   Raise EPipeSeek.Create (ENoSeekMsg);
   Raise EPipeSeek.Create (ENoSeekMsg);
 end;
 end;
+
+procedure PipeClose (const FHandle: THandle); inline;
+begin
+  FileClose(FHandle);
+end;