From d245ba984495e71d0ef0cd5713ae7c5ff68fd1b1 Mon Sep 17 00:00:00 2001 From: fly Date: Tue, 9 Mar 2021 13:18:02 +0000 Subject: [PATCH] Check if build is still running Signed-off-by: fly --- worldbuild-worker.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/worldbuild-worker.py b/worldbuild-worker.py index 4791846..4904c8f 100755 --- a/worldbuild-worker.py +++ b/worldbuild-worker.py @@ -96,7 +96,7 @@ def cleanup(): run("rm -rf projects/worldbuild-" + name, shell=True) - +build = None try: running = True while running: @@ -144,6 +144,7 @@ try: build = Popen("./build -S 10 -t 1 worldbuild-" + name, stdout=log_file, stderr=STDOUT, shell=True, start_new_session=True) build.wait() + build = None cleanup() @@ -156,7 +157,8 @@ except KeyboardInterrupt: print("Graceful shutdown triggered. To force immedate stop, press Ctrl+C again") running = False try: - build.wait() + if build != None: + build.wait() cleanup() if api != None: api_send_status(name, "done", api, api_token)