mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 18:29:09 +02:00
MorphOS: fixed process with Pipes
This commit is contained in:
parent
7a8fae6194
commit
e076c6fc59
@ -147,6 +147,12 @@ begin
|
|||||||
end;
|
end;
|
||||||
try
|
try
|
||||||
{$ifdef MorphOS}
|
{$ifdef MorphOS}
|
||||||
|
if poUsePipes in Options then
|
||||||
|
begin
|
||||||
|
FDescriptors[phtInput].PrepareHandles;
|
||||||
|
FDescriptors[phtOutput].PrepareHandles;
|
||||||
|
//FDescriptors[phtError].PrepareHandles;
|
||||||
|
end;
|
||||||
if (not (poWaitOnExit in Options)) then
|
if (not (poWaitOnExit in Options)) then
|
||||||
begin
|
begin
|
||||||
FProcessID := 0;
|
FProcessID := 0;
|
||||||
@ -172,8 +178,8 @@ begin
|
|||||||
SetVBuf(outB, nil, BUF_LINE, -1);
|
SetVBuf(outB, nil, BUF_LINE, -1);
|
||||||
// the actual Start of the command with given parameter and streams
|
// the actual Start of the command with given parameter and streams
|
||||||
Res := SystemTags(PAnsiChar(ExecName + ' ' + Params),
|
Res := SystemTags(PAnsiChar(ExecName + ' ' + Params),
|
||||||
[SYS_Input, AsTag(outA),
|
[SYS_Input, AsTag(inB),
|
||||||
SYS_Output, AsTag(inB),
|
SYS_Output, AsTag(outB),
|
||||||
SYS_Asynch, AsTag(True),
|
SYS_Asynch, AsTag(True),
|
||||||
TAG_END]);
|
TAG_END]);
|
||||||
// the two streams will be destroyed by system, we do not need to care about
|
// the two streams will be destroyed by system, we do not need to care about
|
||||||
@ -181,16 +187,16 @@ begin
|
|||||||
if Res <> -1 then
|
if Res <> -1 then
|
||||||
begin
|
begin
|
||||||
FProcessID := 1;
|
FProcessID := 1;
|
||||||
|
// Remove the Used Pipe end because they will be freed by the system
|
||||||
|
FDescriptors[phtInput].FTheirHandle := INVALID_HANDLE_VALUE;
|
||||||
|
FDescriptors[phtOutput].FTheirHandle := INVALID_HANDLE_VALUE;
|
||||||
// No longer needed, done in TIOFileDescriptor
|
// No longer needed, done in TIOFileDescriptor
|
||||||
// CreateStreams(THandle(outB), THandle(inA),0);
|
// CreateStreams(THandle(outB), THandle(inA),0);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
// if the command did not start, we need to delete all Streams
|
// if the command did not start, we need to delete all Streams
|
||||||
if outB <> BPTR(0) then DosClose(outB);
|
// not needed to remove the pipes anymore the descriptors will care about that
|
||||||
if outA <> BPTR(0) then DosClose(outA);
|
|
||||||
if inB <> BPTR(0) then DosClose(inB);
|
|
||||||
if inA <> BPTR(0) then DosClose(inA);
|
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user