Commit a52ea2ff authored by Jérome Perrin's avatar Jérome Perrin

Slaprunner: Support command exiting with non 0 status in minishell

parent 778eab49
...@@ -45,8 +45,11 @@ $(document).ready(function () { ...@@ -45,8 +45,11 @@ $(document).ready(function () {
timeout: 600000 timeout: 600000
}) })
.done( function (data) { .done( function (data) {
var data = "<p><span class=\"runned-command\">" + data.path + " >>> " + command + "</span></p><br/><pre>" + data.data + "</pre><br/>"; var output = $("<pre>").text(data.data);
$("#shell-result").append(data); if (data.error) {
output.css({"color": "red"});
}
$("#shell-result").append("<p><span class=\"runned-command\">" + data.path + " >>> " + command + "</span></p><br/>").append(output);
$("#shell-input").val(""); $("#shell-input").val("");
$("#shell-result").scrollTop($("#shell-result")[0].scrollHeight); $("#shell-result").scrollTop($("#shell-result")[0].scrollHeight);
updateHistory(); updateHistory();
......
...@@ -753,9 +753,7 @@ def runCommand(): ...@@ -753,9 +753,7 @@ def runCommand():
command = "timeout 600 " + command command = "timeout 600 " + command
return jsonify(path=cwd, data=subprocess.check_output(command, stderr=subprocess.STDOUT, shell=True, cwd=cwd, env={'PATH': app.config['path']})) return jsonify(path=cwd, data=subprocess.check_output(command, stderr=subprocess.STDOUT, shell=True, cwd=cwd, env={'PATH': app.config['path']}))
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
error = "Error : process exited with exit code " + str(e.returncode) + \ return jsonify(path=cwd, data=e.output, returncode=e.returncode, error=True)
"\nProcess says :\n" + e.output
return error
def getMiniShellHistory(): def getMiniShellHistory():
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment