mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 17:29:10 +02:00
Try to fix linux deadlock when inferiors generate lots of output to stderr
git-svn-id: trunk@28972 -
This commit is contained in:
parent
75afdf052b
commit
8f58b93e39
@ -1736,11 +1736,6 @@ var
|
|||||||
until ConsoleOutput.Position >= BytesRead;
|
until ConsoleOutput.Position >= BytesRead;
|
||||||
|
|
||||||
ConsoleOutput.Position := BuffPos;
|
ConsoleOutput.Position := BuffPos;
|
||||||
end
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
// no data, wait 100 ms
|
|
||||||
Sleep(100);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Result := n;
|
Result := n;
|
||||||
@ -1759,7 +1754,19 @@ begin
|
|||||||
|
|
||||||
P.Execute;
|
P.Execute;
|
||||||
while P.Running do
|
while P.Running do
|
||||||
ReadFromStream(false);
|
begin
|
||||||
|
// Only call ReadFromStream if Data from corresponding stream
|
||||||
|
// is already available, otherwise, on linux, the read call
|
||||||
|
// is blocking, and thus it is not possible to be sure to handle
|
||||||
|
// big data amounts bboth on output and stderr pipes. PM.
|
||||||
|
if P.Output.NumBytesAvailable > 0 then
|
||||||
|
ReadFromStream(false)
|
||||||
|
else if P.StdErr.NumBytesAvailable > 0 then
|
||||||
|
ReadFromStream(true)
|
||||||
|
else
|
||||||
|
// no data, wait 100 ms
|
||||||
|
Sleep(100);
|
||||||
|
end;
|
||||||
|
|
||||||
// read last part
|
// read last part
|
||||||
repeat
|
repeat
|
||||||
|
Loading…
Reference in New Issue
Block a user