From 4c9c211f9786d487986bcf11cd31538f0008d557 Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 17 Jun 2024 12:44:38 -0500 Subject: [PATCH] wip --- selfdrive/manager/process.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/selfdrive/manager/process.py b/selfdrive/manager/process.py index 9168f9f..a6612ac 100755 --- a/selfdrive/manager/process.py +++ b/selfdrive/manager/process.py @@ -51,13 +51,27 @@ def launcher(proc: str, name: str, log_path: str) -> None: sentry.capture_exception() raise +# def nativelauncher(pargs: list[str], cwd: str, name: str) -> None: +# os.environ['MANAGER_DAEMON'] = name + +# global _log_dir +# log_path = _log_dir+"/"+self.name+".log" + +# # exec the process +# os.chdir(cwd) +# os.execvp(pargs[0], pargs) def nativelauncher(pargs: list[str], cwd: str, name: str) -> None: os.environ['MANAGER_DAEMON'] = name + + global _log_dir + log_path = os.path.join(_log_dir, f"{name}.log") - # exec the process - os.chdir(cwd) - os.execvp(pargs[0], pargs) + # Command construction + command = f"bash -c \"{ ' '.join(pargs) } 2>&1 | tee {log_path}\"" + + # Execute the command in the specified directory + subprocess.run(command, shell=True, cwd=cwd, executable='/bin/bash') def join_process(process: Process, timeout: float) -> None: