ui: svpn_run_profile use systemd-run --no-block
This commit is contained in:
@@ -175,12 +175,13 @@ def run_systemd_unit(cmdline: str, *, unit: str) -> str:
|
||||
"--user",
|
||||
"--unit",
|
||||
unit,
|
||||
"--no-block",
|
||||
"--collect",
|
||||
"--same-dir",
|
||||
] + args
|
||||
|
||||
try:
|
||||
p = subprocess.run(run_cmd, capture_output=True, text=True, check=False, timeout=8)
|
||||
p = subprocess.run(run_cmd, capture_output=True, text=True, check=False, timeout=6)
|
||||
except subprocess.TimeoutExpired as e:
|
||||
raise RuntimeError("systemd-run timed out") from e
|
||||
out = ((p.stdout or "") + (p.stderr or "")).strip()
|
||||
@@ -296,4 +297,3 @@ if __name__ == "__main__":
|
||||
except Exception as e:
|
||||
log(f"ERROR: {e}")
|
||||
raise SystemExit(1)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user