🎨 playground 输出
This commit is contained in:
parent
7576910f43
commit
72a7281513
|
@ -179,7 +179,7 @@ func RunHandler(w http.ResponseWriter, r *http.Request, channel map[string]*util
|
||||||
cmd.Process.Kill()
|
cmd.Process.Kill()
|
||||||
}
|
}
|
||||||
|
|
||||||
channelRet["output"] = "<span class='stderr'>run program timeout in 5s</span>\n"
|
channelRet["output"] = "\n<span class='stderr'>run program timeout in 5s</span>\n"
|
||||||
kill = true
|
kill = true
|
||||||
case <-done:
|
case <-done:
|
||||||
channelRet["output"] = "\n<span class='stderr'>run program complete</span>\n"
|
channelRet["output"] = "\n<span class='stderr'>run program complete</span>\n"
|
||||||
|
|
|
@ -305,8 +305,11 @@ var playground = {
|
||||||
|
|
||||||
playground.pid = data.pid;
|
playground.pid = data.pid;
|
||||||
|
|
||||||
var val = $("#output").val();
|
var output = data.output;
|
||||||
$("#output").val(val + data.output);
|
output = output.replace(/\r/g, '');
|
||||||
|
output = output.replace(/\n/g, '<br/>');
|
||||||
|
var oldOutput = $("#output").html();
|
||||||
|
$("#output").html(oldOutput + output);
|
||||||
};
|
};
|
||||||
playgroundWS.onclose = function (e) {
|
playgroundWS.onclose = function (e) {
|
||||||
console.log('[playground onclose] disconnected (' + e.code + ')');
|
console.log('[playground onclose] disconnected (' + e.code + ')');
|
||||||
|
@ -424,7 +427,7 @@ var playground = {
|
||||||
var request = newWideRequest();
|
var request = newWideRequest();
|
||||||
request.code = code;
|
request.code = code;
|
||||||
|
|
||||||
$("#output").val("");
|
$("#output").html("");
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
|
@ -455,7 +458,7 @@ var playground = {
|
||||||
|
|
||||||
var data = result.data;
|
var data = result.data;
|
||||||
|
|
||||||
$("#output").val(data.output);
|
$("#output").html(data.output);
|
||||||
|
|
||||||
if (!result.succ) {
|
if (!result.succ) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -64,7 +64,9 @@
|
||||||
<div id="editorDiv">
|
<div id="editorDiv">
|
||||||
<textarea rows="20" id='editor' class="fn-none">{{.code}}</textarea>
|
<textarea rows="20" id='editor' class="fn-none">{{.code}}</textarea>
|
||||||
</div>
|
</div>
|
||||||
<textarea id="output" rows="20" readonly="readonly" ></textarea>
|
<div class="bottom-window-group">
|
||||||
|
<div id="output" class="output"></div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="fn-right" id="goNews"></div>
|
<div class="fn-right" id="goNews"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue