diff --git a/session/processes.go b/session/processes.go
index 00ebab2..d4a06ee 100644
--- a/session/processes.go
+++ b/session/processes.go
@@ -179,7 +179,7 @@ func RunHandler(w http.ResponseWriter, r *http.Request, channel map[string]*util
cmd.Process.Kill()
}
- channelRet["output"] = "run program timeout in 5s\n"
+ channelRet["output"] = "\nrun program timeout in 5s\n"
kill = true
case <-done:
channelRet["output"] = "\nrun program complete\n"
diff --git a/static/js/playground.js b/static/js/playground.js
index 7e5000a..cd00e3a 100644
--- a/static/js/playground.js
+++ b/static/js/playground.js
@@ -305,8 +305,11 @@ var playground = {
playground.pid = data.pid;
- var val = $("#output").val();
- $("#output").val(val + data.output);
+ var output = data.output;
+ output = output.replace(/\r/g, '');
+ output = output.replace(/\n/g, '
');
+ var oldOutput = $("#output").html();
+ $("#output").html(oldOutput + output);
};
playgroundWS.onclose = function (e) {
console.log('[playground onclose] disconnected (' + e.code + ')');
@@ -424,7 +427,7 @@ var playground = {
var request = newWideRequest();
request.code = code;
- $("#output").val("");
+ $("#output").html("");
$.ajax({
type: 'POST',
@@ -455,7 +458,7 @@ var playground = {
var data = result.data;
- $("#output").val(data.output);
+ $("#output").html(data.output);
if (!result.succ) {
return;
diff --git a/views/playground/index.html b/views/playground/index.html
index 20b5a38..f8c8957 100644
--- a/views/playground/index.html
+++ b/views/playground/index.html
@@ -64,7 +64,9 @@