🎨 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()
|
||||
}
|
||||
|
||||
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
|
||||
case <-done:
|
||||
channelRet["output"] = "\n<span class='stderr'>run program complete</span>\n"
|
||||
|
|
|
@ -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, '<br/>');
|
||||
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;
|
||||
|
|
|
@ -64,7 +64,9 @@
|
|||
<div id="editorDiv">
|
||||
<textarea rows="20" id='editor' class="fn-none">{{.code}}</textarea>
|
||||
</div>
|
||||
<textarea id="output" rows="20" readonly="readonly" ></textarea>
|
||||
<div class="bottom-window-group">
|
||||
<div id="output" class="output"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="fn-right" id="goNews"></div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue