src/eric7/Debugger/DebuggerInterfacePython.py

branch
eric7-maintenance
changeset 10659
43ead32943ca
parent 10616
4aa36fcd4a30
parent 10653
d169909ad8d2
child 10694
f46c1e224e8a
--- a/src/eric7/Debugger/DebuggerInterfacePython.py	Sun Mar 03 10:39:56 2024 +0100
+++ b/src/eric7/Debugger/DebuggerInterfacePython.py	Tue Apr 02 10:00:22 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