wait for instance to fully terminate before restart
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -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):
|
||||||
|
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)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user