Skip to content

Commit cdd170d

Browse files
committed
Fix compilation issues
1 parent fd5c2fc commit cdd170d

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

tools/config_editor/compile.py

+10-5
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def compile_libs(self) -> None:
3434
self.print_output("======== Compiling for " + target.upper() + " ========")
3535

3636
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
3838

3939
if self.app.setting_enable_copy:
4040
if os.path.isdir(self.app.setting_arduino_path):
@@ -56,7 +56,7 @@ def compile_libs(self) -> None:
5656

5757
self.print_output("Running: " + " ".join(command) + "\n")
5858
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)
6060
try:
6161
for output in self.child_process.stdout:
6262
if output == '' and self.child_process.poll() is not None:
@@ -86,12 +86,17 @@ def compile_libs(self) -> None:
8686

8787
def on_button_pressed(self, event: Button.Pressed) -> None:
8888
# Event handler called when a button is pressed
89+
self.workers.cancel_all()
8990
if self.child_process:
90-
# Kill the child process if it is running
91+
# Terminate the child process if it is running
9192
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
9399
self.child_process.wait()
94-
self.child_process = None
95100
self.dismiss()
96101

97102
@on(ScreenResume)

0 commit comments

Comments
 (0)