hotfix(cli): replace raw subprocess tracebacks with styled error messages and fix restart race condition #96

Merged
zach merged 5 commits from hotfix-restart-race-condition into main 2026-05-24 18:23:43 +02:00
3 changed files with 7 additions and 1 deletions
Showing only changes of commit d0cda51639 - Show all commits
+7 -1
View File
@@ -1,4 +1,5 @@
import subprocess import subprocess
import time
import typer import typer
args = ["qs", "-c", "zshell"] args = ["qs", "-c", "zshell"]
@@ -8,7 +9,7 @@ app = typer.Typer()
@app.command() @app.command()
def kill(): def kill():
subprocess.run(args + ["kill"], check=True) subprocess.run(args + ["kill"], check=False)
@app.command() @app.command()
@@ -19,6 +20,11 @@ def start(no_daemon: bool = False):
@app.command() @app.command()
def restart(no_daemon: bool = False): def restart(no_daemon: bool = False):
subprocess.run(args + ["kill"], check=False) subprocess.run(args + ["kill"], check=False)
for _ in range(50):
zach marked this conversation as resolved Outdated
Outdated
Review

The start command should not need to run qs -c zshell ipc call, IPC calls are used to trigger states and functions within the QML code. The -n flag already checks if there's a running instance of the shell.

The start command should not need to run `qs -c zshell ipc call`, IPC calls are used to trigger states and functions within the QML code. The `-n` flag already checks if there's a running instance of the shell.
Outdated
Review

Was not aware of this. Remaining functions use ipc, which is why I did not bat an eye. Resolving now.

Was not aware of this. Remaining functions use ipc, which is why I did not bat an eye. Resolving now.
Outdated
Review

Change occurred since I wanted an error block such as in the screenshot. But with that info, ipc is indeed not needed in the code.

Change occurred since I wanted an error block such as in the screenshot. But with that info, ipc is indeed not needed in the code.
result = subprocess.run(args + ["kill"], capture_output=True)
if result.returncode == 255:
break
time.sleep(0.05)
subprocess.run(args + ["-n"] + ([] if no_daemon else ["-d"]), check=True) subprocess.run(args + ["-n"] + ([] if no_daemon else ["-d"]), check=True)
8