From b115e34f158926fbce6b91388aabf5dcae7fbdfb Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Thu, 16 May 2019 18:59:39 +0800 Subject: [PATCH] :art: Fix #318 --- playground/run.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/playground/run.go b/playground/run.go index 95422a0..ab5ae54 100644 --- a/playground/run.go +++ b/playground/run.go @@ -124,7 +124,7 @@ func RunHandler(w http.ResponseWriter, r *http.Request) { oneRuneStr = strings.Replace(oneRuneStr, ">", ">", -1) channelRet["cmd"] = "run" channelRet["output"] = oneRuneStr - wsChannel := session.OutputWS[sid] + wsChannel := session.PlaygroundWS[sid] if nil != wsChannel { wsChannel.WriteJSON(&channelRet) wsChannel.Refresh() @@ -142,8 +142,8 @@ func RunHandler(w http.ResponseWriter, r *http.Request) { oneRuneStr = strings.Replace(oneRuneStr, "<", "<", -1) oneRuneStr = strings.Replace(oneRuneStr, ">", ">", -1) channelRet["cmd"] = "run" - channelRet["output"] = "" + oneRuneStr + "" - wsChannel := session.OutputWS[sid] + channelRet["output"] = oneRuneStr + wsChannel := session.PlaygroundWS[sid] if nil != wsChannel { wsChannel.WriteJSON(&channelRet) wsChannel.Refresh() @@ -157,9 +157,7 @@ func RunHandler(w http.ResponseWriter, r *http.Request) { channelRet["cmd"] = "run-done" if 124 == cmd.ProcessState.ExitCode() { - channelRet["output"] = "run program timeout in 5s\n" - } else { - channelRet["output"] = "\nrun program complete\n" + channelRet["output"] = "\nrun program timeout in 5s\n" } if nil != wsChannel { wsChannel.WriteJSON(&channelRet)