diff options
Diffstat (limited to 'remote-https-runner/runner.py')
| -rw-r--r-- | remote-https-runner/runner.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/remote-https-runner/runner.py b/remote-https-runner/runner.py index 02d0958..54dea4a 100644 --- a/remote-https-runner/runner.py +++ b/remote-https-runner/runner.py @@ -58,8 +58,14 @@ def key(key): logging.info("User runs command:") logging.info(cmd) + success = True start = time.time() - output = subprocess.check_output(cmd, shell=True) + try: + output = subprocess.check_output(cmd, shell=True) + except Exception, e: + success = False + output = str(e) + end = time.time() duration = "{:.2f}".format(end - start) @@ -73,7 +79,8 @@ def key(key): return jsonify({ "command": cmd, "output": str(output), - "duration": duration + "duration": duration, + "success": success }) @app.route("/") |
