Skip to content

Commit

Permalink
fix: bridge proxy kill children as well
Browse files Browse the repository at this point in the history
  • Loading branch information
martykan committed Sep 6, 2024
1 parent b99eceb commit b8338f7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/bridge_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ def start() -> None:

file_path = os.path.join(os.path.dirname(__file__), "bridge_proxy_server.py")

command = f"python {file_path}"
command_list = ["python", file_path]

BRIDGE_PROXY = Popen(command, shell=True)
BRIDGE_PROXY = Popen(command_list)
log(f"Bridge proxy spawned: {BRIDGE_PROXY}. CMD: {BRIDGE_PROXY.cmdline()}")

# Verifying if the proxy is really running
Expand All @@ -54,4 +54,9 @@ def stop() -> None:
else:
BRIDGE_PROXY.kill()
log(f"Bridge proxy killed: {BRIDGE_PROXY}")
# Ensuring all child processes are cleaned up
for child in BRIDGE_PROXY.children(recursive=True):
log(f"Killing child process {child.pid}")
child.kill()
child.wait()
BRIDGE_PROXY = None

0 comments on commit b8338f7

Please sign in to comment.