瀏覽代碼

idf_monitor: Fix bug with Windows 10 sometimes printing a character twice

Turns out when IOError is thrown by the console, the character is
also successfully displayed.

Revisits fix from https://github.com/espressif/esp-idf/issues/1136

As reported https://esp32.com/viewtopic.php?f=14&t=4766&p=20637
Angus Gratton 8 年之前
父節點
當前提交
3e83cfd77c
共有 1 個文件被更改,包括 7 次插入9 次删除
  1. 7 9
      tools/idf_monitor.py

+ 7 - 9
tools/idf_monitor.py

@@ -580,15 +580,13 @@ if os.name == 'nt':
             self.matched = b''
 
         def _output_write(self, data):
-            # Windows 10 bug since the Fall Creators Update, sometimes writing to console randomly fails
-            # (but usually succeeds afterwards, it seems.)
-            # Ref https://github.com/espressif/esp-idf/issues/1136
-            for tries in range(3):
-                try:
-                    self.output.write(data)
-                    return
-                except IOError:
-                    pass
+            try:
+                self.output.write(data)
+            except IOError:
+                # Windows 10 bug since the Fall Creators Update, sometimes writing to console randomly throws
+                # an exception (however, the character is still written to the screen)
+                # Ref https://github.com/espressif/esp-idf/issues/1136
+                pass
 
         def write(self, data):
             for b in data: