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",
|
"--user",
|
||||||
"--unit",
|
"--unit",
|
||||||
unit,
|
unit,
|
||||||
|
"--no-block",
|
||||||
"--collect",
|
"--collect",
|
||||||
"--same-dir",
|
"--same-dir",
|
||||||
] + args
|
] + args
|
||||||
|
|
||||||
try:
|
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:
|
except subprocess.TimeoutExpired as e:
|
||||||
raise RuntimeError("systemd-run timed out") from e
|
raise RuntimeError("systemd-run timed out") from e
|
||||||
out = ((p.stdout or "") + (p.stderr or "")).strip()
|
out = ((p.stdout or "") + (p.stderr or "")).strip()
|
||||||
@@ -296,4 +297,3 @@ if __name__ == "__main__":
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
log(f"ERROR: {e}")
|
log(f"ERROR: {e}")
|
||||||
raise SystemExit(1)
|
raise SystemExit(1)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user