mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-14 05:41:16 +02:00
FpDebug: fix reading pty for console window.
(cherry picked from commit 47c34d2e7e
)
This commit is contained in:
parent
7217072918
commit
e44532f395
@ -1417,18 +1417,22 @@ function TDbgLinuxProcess.GetConsoleOutput: string;
|
||||
var
|
||||
ABytesAvailable: DWord;
|
||||
ABytesRead: cint;
|
||||
s: string;
|
||||
begin
|
||||
if fpioctl(FMasterPtyFd, FIONREAD, @ABytesAvailable)<0 then
|
||||
ABytesAvailable := 0;
|
||||
|
||||
if ABytesAvailable>0 then
|
||||
result := '';
|
||||
while ABytesAvailable>0 do
|
||||
begin
|
||||
setlength(result, ABytesAvailable);
|
||||
ABytesRead := fpRead(FMasterPtyFd, result[1], ABytesAvailable);
|
||||
SetLength(result, ABytesRead);
|
||||
end
|
||||
else
|
||||
result := '';
|
||||
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;
|
||||
|
||||
procedure TDbgLinuxProcess.SendConsoleInput(AString: string);
|
||||
|
Loading…
Reference in New Issue
Block a user