From 2b4b6e2366591673f406578795e3750af67e04a4 Mon Sep 17 00:00:00 2001 From: Adrian Pop Date: Sat, 2 Nov 2024 02:07:40 +0100 Subject: [PATCH] use os._exit(exitStatus) instead of haging sys.exit(exitStatus) --- shared.py | 4 ++-- testmodel.py | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/shared.py b/shared.py index 27e100b..6c8f7f3 100644 --- a/shared.py +++ b/shared.py @@ -91,8 +91,8 @@ def simulationAcceptsFlag(f, checkOutput=True, cwd=None, isWin=False): else: subprocess.check_output("./HelloWorld %s" % f, shell=True, stderr=subprocess.STDOUT, cwd=cwd) - if (not os.path.exists("HelloWorld_res.mat")): - print("Result file HelloWorld_res.mat WAS NOT generated running: ./HelloWorld with flags [%s]" % f) + #if (not os.path.exists("HelloWorld_res.mat")): + # print("Result file HelloWorld_res.mat WAS NOT generated running: ./HelloWorld with flags [%s]" % f) if (not checkOutput) or os.path.exists("HelloWorld_res.mat"): return True except subprocess.CalledProcessError as e: diff --git a/testmodel.py b/testmodel.py index 1e3ba20..972ea1b 100755 --- a/testmodel.py +++ b/testmodel.py @@ -44,7 +44,11 @@ def writeResult(): def writeResultAndExit(exitStatus): writeResult() - sys.exit(exitStatus) + print("Calling exit ...") + sys.stdout.flush() + os._exit(exitStatus) + # calling sys.exit will hang in lock.acquire() + # sys.exit(exitStatus) def sendExpressionTimeout(omc, cmd, timeout): with open(errFile, 'a+') as fp: