src/eric7/MicroPython/MicroPythonDeviceInterface.py

branch
mpy_network
changeset 9775
c6806d24468b
parent 9766
f0e22f3a5878
child 9799
a79430a8811d
--- a/src/eric7/MicroPython/MicroPythonDeviceInterface.py	Sat Feb 18 09:21:42 2023 +0100
+++ b/src/eric7/MicroPython/MicroPythonDeviceInterface.py	Sat Feb 18 10:11:44 2023 +0100
@@ -189,7 +189,7 @@
 
         return True
 
-    def execute(self, commands):
+    def execute(self, commands, timeout=0):
         """
         Public method to send commands to the connected device and return the
         result.
@@ -198,6 +198,9 @@
 
         @param commands list of commands to be executed
         @type str or list of str
+        @param timeout per command timeout in milliseconds (0 for configured default)
+            (defaults to 0)
+        @type int (optional)
         @return tuple containing stdout and stderr output of the device
         @rtype tuple of (bytes, bytes)
         """
@@ -239,7 +242,7 @@
                     )
 
                 # read until prompt
-                response = self.__serial.readUntil(b"\x04>")
+                response = self.__serial.readUntil(b"\x04>", timeout=timeout)
                 if self.__serial.hasTimedOut():
                     self.__blockReadyRead = False
                     return b"", b"Timeout while processing commands."

eric ide

mercurial