diff --git a/selfdrive/clearpilot/resource/DALL·E 2024-05-17 09.54.42 - Logo for a self-driving software called ClearPilot. The logo features a glass steering wheel where the transparent glass has a backdrop of a scene of .webp b/selfdrive/clearpilot/resource/DALL·E 2024-05-17 09.54.42 - Logo for a self-driving software called ClearPilot. The logo features a glass steering wheel where the transparent glass has a backdrop of a scene of .webp old mode 100644 new mode 100755 diff --git a/selfdrive/clearpilot/resource/debug_ui_scene.png b/selfdrive/clearpilot/resource/debug_ui_scene.png old mode 100644 new mode 100755 diff --git a/selfdrive/frogpilot/screenrecorder/moc_screenrecorder.cc b/selfdrive/frogpilot/screenrecorder/moc_screenrecorder.cc old mode 100644 new mode 100755 diff --git a/selfdrive/frogpilot/ui/qt/offroad/moc_control_settings.cc b/selfdrive/frogpilot/ui/qt/offroad/moc_control_settings.cc old mode 100644 new mode 100755 diff --git a/selfdrive/frogpilot/ui/qt/offroad/moc_vehicle_settings.cc b/selfdrive/frogpilot/ui/qt/offroad/moc_vehicle_settings.cc old mode 100644 new mode 100755 diff --git a/selfdrive/frogpilot/ui/qt/offroad/moc_visual_settings.cc b/selfdrive/frogpilot/ui/qt/offroad/moc_visual_settings.cc old mode 100644 new mode 100755 diff --git a/selfdrive/frogpilot/ui/qt/widgets/moc_frogpilot_controls.cc b/selfdrive/frogpilot/ui/qt/widgets/moc_frogpilot_controls.cc old mode 100644 new mode 100755 diff --git a/selfdrive/manager/process.py b/selfdrive/manager/process.py index 5655655..b72772a 100755 --- a/selfdrive/manager/process.py +++ b/selfdrive/manager/process.py @@ -27,26 +27,42 @@ def nativelauncher(pargs: list[str], cwd: str, name: str, log_path: str) -> None with open(log_path, 'a') as log_file: os.chdir(cwd) proc = subprocess.Popen(pargs, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=1, universal_newlines=True) + log_file.write("Started "+name) for line in proc.stdout: print(line, end='') log_file.write(line) proc.wait() def launcher(proc: str, name: str, log_path: str) -> None: - try: - mod = importlib.import_module(proc) - setproctitle(proc) - messaging.context = messaging.Context() - cloudlog.bind(daemon=name) - sentry.set_tag("daemon", name) - with open(log_path, 'a') as log_file, subprocess.Popen(['python', '-m', proc], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=1, universal_newlines=True) as proc: - for line in proc.stdout: - print(line, end='') - log_file.write(line) - proc.wait() - except Exception: - sentry.capture_exception() - raise + while True: + try: + # Initialize the module and setup the process title and logging + mod = importlib.import_module(proc) + setproctitle(name) + messaging.context = messaging.Context() + cloudlog.bind(daemon=name) + sentry.set_tag("daemon", name) + + # Command to run the process + command = ['python', '-m', proc] + + # Open the log file and start the subprocess + with open(log_path, 'a') as log_file, subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=1, universal_newlines=True) as proc_instance: + log_file.write(f"Started {name}\n") + + # Process the output from the subprocess + for line in iter(proc_instance.stdout.readline, ''): + print(line, end='') + log_file.write(line) + + # Wait for the subprocess to terminate + proc_instance.wait() + + except Exception as e: + # Log the error and restart the process after logging the exception + print(f"Fatal: {name}") + print(e) + sentry.capture_exception() def join_process(process: Process, timeout: float) -> None: t = time.monotonic() @@ -215,14 +231,13 @@ class DaemonProcess(ManagerProcess): except OSError: pass # Process not running, continue to start it - log_file_path = os.path.join(log_path, f"{self.name}.log") - self.params.put(self.param_name, str(self.proc.pid)) cloudlog.info(f"starting daemon {self.name}") self.proc = subprocess.Popen(['python', '-m', self.module], stdin=open('/dev/null'), - stdout=open(log_file_path, 'a'), + stdout=open(log_path, 'a'), stderr=subprocess.STDOUT, preexec_fn=os.setpgrp) + self.params.put(self.param_name, str(self.proc.pid)) def stop(self, retry=True, block=True, sig=None) -> None: pass @@ -237,7 +252,7 @@ def ensure_running(procs: ValuesView[ManagerProcess], started: bool, params=None running = [] for p in procs: if p.enabled and p.name not in not_run and p.should_run(started, params, CP): - if p.proc is None or p.proc.exitcode is not None: + if p.proc is None or (hasattr(p.proc, 'exitcode') and p.proc.exitcode is not None): p.start() running.append(p) else: @@ -245,4 +260,4 @@ def ensure_running(procs: ValuesView[ManagerProcess], started: bool, params=None p.check_watchdog(started) - return running \ No newline at end of file + return running diff --git a/system/clearpilot/dev/on_start_brian.sh.cpt b/system/clearpilot/dev/on_start_brian.sh.cpt old mode 100644 new mode 100755