fix handle type; close parent ends of pipes in child process

git-svn-id: trunk@3099 -
This commit is contained in:
micha 2006-03-31 21:29:36 +00:00
parent c18c8e2412
commit 7785471dd4

View File

@ -196,7 +196,7 @@ end;
Type Type
TPipeEnd = (peRead,peWrite); TPipeEnd = (peRead,peWrite);
TPipePair = Array[TPipeEnd] of Integer; TPipePair = Array[TPipeEnd] of cint;
Procedure CreatePipes(Var HI,HO,HE : TPipePair; CE : Boolean); Procedure CreatePipes(Var HI,HO,HE : TPipePair; CE : Boolean);
@ -284,12 +284,17 @@ begin
ChDir(FCurrentDirectory); ChDir(FCurrentDirectory);
if PoUsePipes in Options then if PoUsePipes in Options then
begin begin
fpclose(HI[peWrite]);
fpdup2(HI[peRead],0); fpdup2(HI[peRead],0);
fpclose(HO[peRead]);
fpdup2(HO[peWrite],1); fpdup2(HO[peWrite],1);
if (poStdErrToOutPut in Options) then if (poStdErrToOutPut in Options) then
fpdup2(HO[peWrite],2) fpdup2(HO[peWrite],2)
else else
begin
fpclose(HE[peRead]);
fpdup2(HE[peWrite],2); fpdup2(HE[peWrite],2);
end
end end
else if poNoConsole in Options then else if poNoConsole in Options then
begin begin