hotfix(cli): replace raw subprocess tracebacks with styled error messages and fix restart race condition #96
Binary file not shown.
Binary file not shown.
@@ -1,4 +1,5 @@
|
||||
import subprocess
|
||||
import time
|
||||
import typer
|
||||
|
||||
args = ["qs", "-c", "zshell"]
|
||||
@@ -8,7 +9,7 @@ app = typer.Typer()
|
||||
|
||||
@app.command()
|
||||
def kill():
|
||||
subprocess.run(args + ["kill"], check=True)
|
||||
subprocess.run(args + ["kill"], check=False)
|
||||
|
||||
|
||||
@app.command()
|
||||
@@ -19,6 +20,11 @@ def start(no_daemon: bool = False):
|
||||
@app.command()
|
||||
def restart(no_daemon: bool = False):
|
||||
subprocess.run(args + ["kill"], check=False)
|
||||
for _ in range(50):
|
||||
|
zach marked this conversation as resolved
Outdated
|
||||
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)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user
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-nflag already checks if there's a running instance of the shell.Was not aware of this. Remaining functions use ipc, which is why I did not bat an eye. Resolving now.
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.