src/eric7/MicroPython/MicroPythonWebreplDeviceInterface.py

branch
eric7
changeset 10019
e56089d00750
parent 10016
8db27a64d434
child 10033
91b0939626ff
diff -r 53315c3db26b -r e56089d00750 src/eric7/MicroPython/MicroPythonWebreplDeviceInterface.py
--- a/src/eric7/MicroPython/MicroPythonWebreplDeviceInterface.py	Thu May 04 17:58:52 2023 +0200
+++ b/src/eric7/MicroPython/MicroPythonWebreplDeviceInterface.py	Fri May 05 18:16:57 2023 +0200
@@ -199,17 +199,19 @@
             return (b"", b"Could not switch to paste mode. Is the device switched on?")
 
         # send commands
-        commandBytes = commands.encode("utf-8")
-        self.__socket.writeTextMessage(commandBytes)
-        ok = self.__socket.readUntil(commandBytes)
-        if ok != commandBytes:
-            self.__blockReadyRead = False
-            return (
-                b"",
-                "Expected '{0}', got '{1}', followed by '{2}'".format(
-                    commandBytes, ok, self.__socket.readAll()
-                ).encode("utf-8"),
-            )
+        for command in commands.splitlines(keepends=True):
+            # send the data as single lines
+            commandBytes = command.encode("utf-8")
+            self.__socket.writeTextMessage(commandBytes)
+            ok = self.__socket.readUntil(commandBytes)
+            if ok != commandBytes:
+                self.__blockReadyRead = False
+                return (
+                    b"",
+                    "Expected '{0}', got '{1}', followed by '{2}'".format(
+                        commandBytes, ok, self.__socket.readAll()
+                    ).encode("utf-8"),
+                )
 
         # switch off paste mode causing the commands to be executed
         self.__pasteOff()

eric ide

mercurial