Extra precaution while redirecting STDIO in unix

This commit is contained in:
mysticbbs 2013-02-22 20:47:09 -05:00
parent e6df923fe6
commit 29b90c351f
1 changed files with 3 additions and 5 deletions

View File

@ -135,12 +135,10 @@ Begin
Proc.Execute; Proc.Execute;
While Proc.Running Do Begin While Proc.Running Or (Proc.Output.NumBytesAvailable > 0) Do Begin
If Proc.Output.NumBytesAvailable > 0 Then Begin If Proc.Output.NumBytesAvailable > 0 Then Begin
While Proc.Output.NumBytesAvailable > 0 Do Begin bRead := Proc.Output.Read(Buffer, TIOBufferSize);
bRead := Proc.Output.Read(Buffer, TIOBufferSize); Client.WriteBufEscaped (Buffer, bRead);
Client.WriteBufEscaped (Buffer, bRead);
End;
End Else End Else
If Client.DataWaiting Then Begin If Client.DataWaiting Then Begin
bWrite := Client.ReadBuf(Buffer, TIOBufferSize); bWrite := Client.ReadBuf(Buffer, TIOBufferSize);