From 22893009083d209df7f3dd66e826f80718332a90 Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Mon, 16 Jul 2018 06:00:03 +0200 Subject: [PATCH] [enh] allow to specify path to analyseCI.sh --- run.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/run.py b/run.py index 7d5a411..6051fa4 100644 --- a/run.py +++ b/run.py @@ -138,9 +138,12 @@ async def run_job(worker, job): # fake stupid command, whould run CI instead print(f"Starting job {job.name}...") - command = await asyncio.create_subprocess_shell("/usr/bin/tail -n 100 /var/log/auth.log", - stdout=asyncio.subprocess.PIPE, - stderr=asyncio.subprocess.PIPE) + + cwd = os.path.split(path_to_analyseCI)[0] + command = await asyncio.create_subprocess_shell("/bin/bash " + path_to_analyseCI, + cwd=cwd, + stdout=asyncio.subprocess.PIPE, + stderr=asyncio.subprocess.PIPE) while not command.stdout.at_eof(): data = await command.stdout.readline() @@ -336,6 +339,13 @@ async def index(request): if __name__ == "__main__": + if not sys.argv[1:]: + print("Error: missing shell path argument") + print("Usage: python run.py /path/to/analyseCI.sh") + sys.exit(1) + + path_to_analyseCI = sys.argv[1] + reset_pending_jobs() reset_busy_workers()