Mp4 wsl export tweaks

This commit is contained in:
whoisdomi
2026-08-06 18:10:29 -05:00
parent 06adeb71fd
commit a149d2624a
3 changed files with 82 additions and 20 deletions
+4 -1
View File
@@ -50,7 +50,10 @@ class OpenpilotPrefix:
symlink_path = Params().get_param_path()
if os.path.exists(symlink_path):
shutil.rmtree(os.path.realpath(symlink_path), ignore_errors=True)
os.remove(symlink_path)
# when the params path is a real directory rather than a symlink, rmtree above already
# removed it and there is no link left to unlink
if os.path.islink(symlink_path):
os.remove(symlink_path)
shutil.rmtree(self.msgq_path, ignore_errors=True)
if PC:
shutil.rmtree(Paths.log_root(), ignore_errors=True)
+14 -10
View File
@@ -5,7 +5,7 @@ import contextlib
import subprocess
import time
import functools
from subprocess import Popen, PIPE, TimeoutExpired
from subprocess import Popen, PIPE, STDOUT, TimeoutExpired
import zstandard as zstd
from openpilot.common.swaglog import cloudlog
@@ -87,16 +87,20 @@ def run_cmd_default(cmd: list[str], default: str = "", cwd=None, env=None) -> st
@contextlib.contextmanager
def managed_proc(cmd: list[str], env: dict[str, str]):
proc = Popen(cmd, env=env, stdout=PIPE, stderr=PIPE)
try:
yield proc
finally:
if proc.poll() is None:
proc.terminate()
# capture output to a temp file rather than a pipe. nothing drains the pipe while the process
# runs, so a long lived, chatty child would eventually fill the pipe buffer and block forever.
with tempfile.TemporaryFile() as log_file:
proc = Popen(cmd, env=env, stdout=log_file, stderr=STDOUT)
proc.log_file = log_file
try:
proc.wait(timeout=5)
except TimeoutExpired:
proc.kill()
yield proc
finally:
if proc.poll() is None:
proc.terminate()
try:
proc.wait(timeout=5)
except TimeoutExpired:
proc.kill()
def retry(attempts=3, delay=1.0, ignore_failure=False):