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 () {
timeout: 600000
})
.done( function (data) {
var data = "<p><span class=\"runned-command\">" + data.path + " >>> " + command + "</span></p><br/><pre>" + data.data + "</pre><br/>";
$("#shell-result").append(data);
var output = $("<pre>").text(data.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-result").scrollTop($("#shell-result")[0].scrollHeight);
updateHistory();
......
......@@ -753,9 +753,7 @@ def runCommand():
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']}))
except subprocess.CalledProcessError as e:
error = "Error : process exited with exit code " + str(e.returncode) + \
"\nProcess says :\n" + e.output
return error
return jsonify(path=cwd, data=e.output, returncode=e.returncode, error=True)
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