|
@@ -1510,7 +1510,7 @@ var
|
|
|
P: TProcess;
|
|
|
BytesRead: longint;
|
|
|
|
|
|
- function ReadFromStream: longint;
|
|
|
+ function ReadFromStream(const ReadFromStdErr: boolean): longint;
|
|
|
|
|
|
const
|
|
|
READ_BYTES = 2048;
|
|
@@ -1534,7 +1534,10 @@ var
|
|
|
ConsoleOutput.SetSize(BytesRead + READ_BYTES);
|
|
|
|
|
|
// try reading it
|
|
|
- n := P.Output.Read((ConsoleOutput.Memory + BytesRead)^, READ_BYTES);
|
|
|
+ if ReadFromStdErr then
|
|
|
+ n := P.Stderr.Read((ConsoleOutput.Memory + BytesRead)^, READ_BYTES)
|
|
|
+ else
|
|
|
+ n := P.Output.Read((ConsoleOutput.Memory + BytesRead)^, READ_BYTES);
|
|
|
if n > 0 then
|
|
|
begin
|
|
|
Inc(BytesRead, n);
|
|
@@ -1602,11 +1605,17 @@ begin
|
|
|
|
|
|
P.Execute;
|
|
|
while P.Running do
|
|
|
- ReadFromStream;
|
|
|
+ ReadFromStream(false);
|
|
|
|
|
|
// read last part
|
|
|
repeat
|
|
|
- until ReadFromStream = 0;
|
|
|
+ until ReadFromStream(false)=0;
|
|
|
+
|
|
|
+ // read stderr
|
|
|
+ // JvdS: Note that this way stderr is added to the end of the stream. But I
|
|
|
+ // see no way showing the stderr output at the place it was actually written
|
|
|
+ repeat
|
|
|
+ until ReadFromStream(true)=0;
|
|
|
ConsoleOutput.SetSize(BytesRead);
|
|
|
|
|
|
result := P.ExitStatus;
|