From fdacf84b2fb66cbc68b920ec1102bd2210d6d2fb Mon Sep 17 00:00:00 2001 From: Joachim Klein Date: Fri, 18 Aug 2017 18:21:11 +0200 Subject: [PATCH] prism-auto: in nailgun mode, try to stop existing server first Sometimes, if the prism-auto scripts gets interrupted, an existing nailgun server is not properly shut down and might break a subsequent prism-auto run. --- prism/etc/scripts/prism-auto | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/prism/etc/scripts/prism-auto b/prism/etc/scripts/prism-auto index 2f148337..9c202ecc 100755 --- a/prism/etc/scripts/prism-auto +++ b/prism/etc/scripts/prism-auto @@ -741,6 +741,15 @@ def benchmarkPropListFile(propListFile): propFile = items[1].strip() benchmarkPropertiesFile(os.path.join(dir, propFile)) +# (Re-)start the nailgun server +# We first try to stop an existing server (which should fail quickly if there is none running) +def restartNailGunServer(): + print("Stopping existing nailgun server, if it's running...") + subprocess.Popen([options.ngprism, "stop"]).wait() + print("Starting nailgun server...") + os.system(options.prismExec + " -ng &") + time.sleep(0.5) + #================================================================================================== # Main program #================================================================================================== @@ -803,8 +812,7 @@ if options.nailgun: if options.echo or options.echoFull: print(options.prismExec + " -ng &") else: - os.system(options.prismExec + " -ng &") - time.sleep(0.5) + restartNailGunServer(); for arg in args: if os.path.isdir(arg): benchmarkDir(arg)