All loop values from 235 and greater failed:
Several tests with loop values from 235 to 1000 showed NO Output (empty output window) and the IDE always hang.
During 4 tests with loop value=2000 I 3x saw 1136 lines (see screenshot3) and the IDE hang. 1x I saw 1351 lines and the IDE hung.
For the test with cut off output (some output, but not all): Can you try with "sleep(150)" or "sleep(250)" .... "sleep(1550)" ?
The IDE hanging is odd....
If that is related to the patch, it would have to be
function TDbgLinuxProcess.GetConsoleOutput: string;
var
ABytesAvailable: DWord;
ABytesRead: cint;
s: string;
begin
if fpioctl(FMasterPtyFd, FIONREAD, @ABytesAvailable)<0 then
ABytesAvailable := 0;
result := '';
while ABytesAvailable>0 do
begin
setlength(s, ABytesAvailable);
ABytesRead := fpRead(FMasterPtyFd, s[1], ABytesAvailable);
SetLength(s, ABytesRead);
Result := Result + s;
if fpioctl(FMasterPtyFd, FIONREAD, @ABytesAvailable)<0 then
ABytesAvailable := 0;
end;
end;
fpioctl either hangs.... In which case it probably is a race condition that existed before the change too.
Or "ABytesAvailable" never becoming 0.
Maybe your distro has an ioctl implementation that differs... (strange though, since it works for other amounts of data).
Could you please do a test, please.
Add a counter to the above loop, and abort it at 100 iterations.
TESTCNT := 0; ///// <<<<
while (ABytesAvailable>0) AND (TESTCNT < 100) do
begin
inc(TESTCNT); // <<<<<<<<<<<<<<<<
setlength(s, ABytesAvailable);
Then also check, if the output has any unexpected data....
If that still hangs, the fpIoctl probably hangs. Assuming it is not something entirely different.
If you can run the IDE itself in the debugger please.