@@ -57,18 +57,25 @@ def compile_libs(self) -> None:
57
57
self .print_output ("Running: " + " " .join (command ) + "\n " )
58
58
print ("Running: " + " " .join (command ))
59
59
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" )
67
70
68
71
if not self .child_process :
69
72
print ("Compilation failed for " + target .upper () + "Child process failed to start" )
70
73
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 :
72
79
print ("Compilation failed for " + target .upper () + ". Return code: " + str (self .child_process .returncode ))
73
80
self .print_output ("Compilation failed for " + target .upper () + ". Return code: " + str (self .child_process .returncode ))
74
81
self .print_output ("Error: " + self .child_process .stderr .read ())
0 commit comments