@@ -34,7 +34,7 @@ def compile_libs(self) -> None:
34
34
self .print_output ("======== Compiling for " + target .upper () + " ========" )
35
35
36
36
command = ["./build.sh" , "-t" , target , "-D" , self .app .setting_debug_level ]
37
- #command.append("--help") # For testing without compiling
37
+ #command.append("--help") # For testing output without compiling
38
38
39
39
if self .app .setting_enable_copy :
40
40
if os .path .isdir (self .app .setting_arduino_path ):
@@ -56,7 +56,7 @@ def compile_libs(self) -> None:
56
56
57
57
self .print_output ("Running: " + " " .join (command ) + "\n " )
58
58
print ("Running: " + " " .join (command ))
59
- self .child_process = subprocess .Popen (command , stdout = subprocess .PIPE , stderr = subprocess .PIPE , text = True , shell = True )
59
+ self .child_process = subprocess .Popen (command , stdout = subprocess .PIPE , stderr = subprocess .PIPE , text = True )
60
60
try :
61
61
for output in self .child_process .stdout :
62
62
if output == '' and self .child_process .poll () is not None :
@@ -86,12 +86,17 @@ def compile_libs(self) -> None:
86
86
87
87
def on_button_pressed (self , event : Button .Pressed ) -> None :
88
88
# Event handler called when a button is pressed
89
+ self .workers .cancel_all ()
89
90
if self .child_process :
90
- # Kill the child process if it is running
91
+ # Terminate the child process if it is running
91
92
print ("Terminating child process" )
92
- self .child_process .kill ()
93
+ self .child_process .terminate ()
94
+ try :
95
+ self .child_process .stdout .close ()
96
+ self .child_process .stderr .close ()
97
+ except :
98
+ pass
93
99
self .child_process .wait ()
94
- self .child_process = None
95
100
self .dismiss ()
96
101
97
102
@on (ScreenResume )
0 commit comments