Pārlūkot izejas kodu

catch ValueError("I/O operation on closed file.") if frontend crashes (#4150)

benedikt-bartscher 7 mēneši atpakaļ
vecāks
revīzija
1aed39a848
1 mainītis faili ar 8 papildinājumiem un 3 dzēšanām
  1. 8 3
      reflex/testing.py

+ 8 - 3
reflex/testing.py

@@ -394,9 +394,14 @@ class AppHarness:
 
         def consume_frontend_output():
             while True:
-                line = (
-                    self.frontend_process.stdout.readline()  # pyright: ignore [reportOptionalMemberAccess]
-                )
+                try:
+                    line = (
+                        self.frontend_process.stdout.readline()  # pyright: ignore [reportOptionalMemberAccess]
+                    )
+                # catch I/O operation on closed file.
+                except ValueError as e:
+                    print(e)
+                    break
                 if not line:
                     break
                 print(line)