mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2026-12-02 16:07:33 -06:00
Improve compiler/execution/program output
Compact output. Do not print compiler return code if successful execution Print console output with monospaced font Print console stderr with red color
This commit is contained in:
+20
-8
@@ -59,15 +59,19 @@ define(function (require) {
|
||||
this.add(obj.text, obj.tag ? obj.tag.line : obj.line);
|
||||
}, this);
|
||||
|
||||
this.add("Compiler exited with result code " + result.code);
|
||||
if (!result.execResult) {
|
||||
this.add("compiler returned: " + result.code);
|
||||
} else {
|
||||
this.add("program returned: " + result.execResult.code);
|
||||
if (result.execResult.stderr.length || result.execResult.stdout.length) {
|
||||
_.each(result.execResult.stderr, function (obj) {
|
||||
this.programOutput(obj.text, "red");
|
||||
}, this);
|
||||
|
||||
if (result.execResult) {
|
||||
var elem = $('<div><hr></div>').appendTo(this.contentRoot);
|
||||
this.add("Output from execution:");
|
||||
_.each((result.execResult.stdout || []).concat(result.execResult.stderr || []), function (obj) {
|
||||
this.add(obj.text, obj.line);
|
||||
}, this);
|
||||
this.add("User code exited with result code " + result.execResult.code);
|
||||
_.each(result.execResult.stdout, function (obj) {
|
||||
this.programOutput(obj.text);
|
||||
}, this);
|
||||
}
|
||||
}
|
||||
|
||||
this.updateCompilerName();
|
||||
@@ -77,6 +81,14 @@ define(function (require) {
|
||||
if (id === this.compilerId) this.fontScale.setScale(scale);
|
||||
};
|
||||
|
||||
Output.prototype.programOutput = function (msg, color) {
|
||||
var elem = $('<div></div>').appendTo(this.contentRoot);
|
||||
elem.text(msg);
|
||||
elem.css('font-family', '"Courier New", Courier, monospace');
|
||||
if (color)
|
||||
elem.css("color", color);
|
||||
};
|
||||
|
||||
Output.prototype.add = function (msg, lineNum) {
|
||||
var elem = $('<div></div>').appendTo(this.contentRoot);
|
||||
if (lineNum) {
|
||||
|
||||
Reference in New Issue
Block a user