From bb7bef7d56bd04281358f1587f46d523185df4f0 Mon Sep 17 00:00:00 2001 From: Nicolas Setton Date: Fri, 8 Feb 2019 13:37:39 -0500 Subject: [PATCH] Do not run if there is no main Allows using the 'Run' button on packages, to have the compiler validate them. --- infrastructure/container_payload/run.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/infrastructure/container_payload/run.py b/infrastructure/container_payload/run.py index 45fce56..9913b96 100644 --- a/infrastructure/container_payload/run.py +++ b/infrastructure/container_payload/run.py @@ -135,7 +135,7 @@ def safe_run(workdir, mode): p = subprocess.Popen(cl, cwd=workdir, stdout=subprocess.PIPE, shell=False) while True: - line = p.stdout.readline() + line = p.stdout.readline().replace(workdir, '.') if line != '': print line sys.stdout.flush() @@ -163,11 +163,12 @@ def safe_run(workdir, mode): # - as user 'unprivileged' that has no write access # - under a timeout # - with our ld preloader to prevent forks - line = ['sudo', '-u', 'unprivileged', 'timeout', '10s', - 'bash', '-c', - 'LD_PRELOAD=/preloader.so {}'.format( - os.path.join(workdir, main.split('.')[0]))] - c(line) + if main: + line = ['sudo', '-u', 'unprivileged', 'timeout', '10s', + 'bash', '-c', + 'LD_PRELOAD=/preloader.so {}'.format( + os.path.join(workdir, main.split('.')[0]))] + c(line) elif mode == "prove": doctor_main_gpr(workdir, spark_mode=True)