src/eric7/Debugger/DebuggerInterfacePython.py

branch
eric7
changeset 10653
d169909ad8d2
parent 10552
c5b0c8a5fa7d
child 10659
43ead32943ca
child 10680
306373ccf8fd
child 10683
779cda568acb
--- a/src/eric7/Debugger/DebuggerInterfacePython.py	Tue Apr 02 09:46:04 2024 +0200
+++ b/src/eric7/Debugger/DebuggerInterfacePython.py	Tue Apr 02 09:46:36 2024 +0200
@@ -13,6 +13,7 @@
 import os
 import shlex
 import struct
+import time
 import zlib
 
 from PyQt6.QtCore import QObject, QProcess, QProcessEnvironment, QTimer
@@ -1408,11 +1409,17 @@
             length, datahash = struct.unpack(b"!II", header)
 
             data = bytearray()
+            now = time.monotonic()
             while len(data) < length:
                 maxSize = length - len(data)
                 if sock.bytesAvailable() < maxSize:
                     sock.waitForReadyRead(50)
-                data += sock.read(maxSize)
+                newData = sock.read(maxSize)
+                if newData:
+                    data += newData
+                else:
+                    if time.monotonic() - now > 2.0:  # 2 seconds timeout
+                        break
 
             if zlib.adler32(data) & 0xFFFFFFFF != datahash:
                 # corrupted data -> discard and continue

eric ide

mercurial