Skip to content

Commit 54f1082

Browse files
committed
Handle exception
1 parent 6a5319a commit 54f1082

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

Diff for: tools/config_editor/compile.py

+15-8
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,25 @@ def compile_libs(self) -> None:
5757
self.print_output("Running: " + " ".join(command) + "\n")
5858
print("Running: " + " ".join(command))
5959
self.child_process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, shell=True)
60-
for output in self.child_process.stdout:
61-
if output == '' and self.child_process.poll() is not None:
62-
print("Child process finished")
63-
break
64-
if output:
65-
self.print_output(output.strip()) # Update RichLog widget with subprocess output
66-
self.child_process.stdout.close()
60+
try:
61+
for output in self.child_process.stdout:
62+
if output == '' and self.child_process.poll() is not None:
63+
break
64+
if output:
65+
self.print_output(output.strip()) # Update RichLog widget with subprocess output
66+
self.child_process.stdout.close()
67+
except Exception as e:
68+
print("Error reading child process output: " + str(e))
69+
print("Process might have terminated")
6770

6871
if not self.child_process:
6972
print("Compilation failed for " + target.upper() + "Child process failed to start")
7073
label.update("Compilation failed for " + target.upper() + "Child process failed to start")
71-
elif self.child_process.returncode != 0:
74+
return
75+
else:
76+
self.child_process.wait()
77+
78+
if self.child_process.returncode != 0:
7279
print("Compilation failed for " + target.upper() + ". Return code: " + str(self.child_process.returncode))
7380
self.print_output("Compilation failed for " + target.upper() + ". Return code: " + str(self.child_process.returncode))
7481
self.print_output("Error: " + self.child_process.stderr.read())

0 commit comments

Comments
 (0)