🐛 NPE
This commit is contained in:
parent
b97ba481ef
commit
e97ce75b92
|
@ -97,9 +97,11 @@ func RunHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
if nil != wsChannel {
|
if nil != wsChannel {
|
||||||
channelRet["cmd"] = "run"
|
channelRet["cmd"] = "run"
|
||||||
channelRet["output"] = ""
|
channelRet["output"] = ""
|
||||||
|
if nil != wsChannel {
|
||||||
wsChannel.WriteJSON(&channelRet)
|
wsChannel.WriteJSON(&channelRet)
|
||||||
wsChannel.Refresh()
|
wsChannel.Refresh()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
go func(runningId int) {
|
go func(runningId int) {
|
||||||
defer util.Recover()
|
defer util.Recover()
|
||||||
|
@ -117,9 +119,11 @@ func RunHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
channelRet["cmd"] = "run"
|
channelRet["cmd"] = "run"
|
||||||
channelRet["output"] = oneRuneStr + "\n"
|
channelRet["output"] = oneRuneStr + "\n"
|
||||||
wsChannel := session.OutputWS[sid]
|
wsChannel := session.OutputWS[sid]
|
||||||
|
if nil != wsChannel {
|
||||||
wsChannel.WriteJSON(&channelRet)
|
wsChannel.WriteJSON(&channelRet)
|
||||||
wsChannel.Refresh()
|
wsChannel.Refresh()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
errScanner := bufio.NewScanner(errReader)
|
errScanner := bufio.NewScanner(errReader)
|
||||||
|
@ -130,9 +134,11 @@ func RunHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
channelRet["cmd"] = "run"
|
channelRet["cmd"] = "run"
|
||||||
channelRet["output"] = "<span class='stderr'>" + oneRuneStr + "</span>"
|
channelRet["output"] = "<span class='stderr'>" + oneRuneStr + "</span>"
|
||||||
wsChannel := session.OutputWS[sid]
|
wsChannel := session.OutputWS[sid]
|
||||||
|
if nil != wsChannel {
|
||||||
wsChannel.WriteJSON(&channelRet)
|
wsChannel.WriteJSON(&channelRet)
|
||||||
wsChannel.Refresh()
|
wsChannel.Refresh()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
cmd.Wait()
|
cmd.Wait()
|
||||||
|
|
||||||
|
@ -145,8 +151,10 @@ func RunHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
} else {
|
} else {
|
||||||
channelRet["output"] = "\n<span class='stderr'>run program complete</span>\n"
|
channelRet["output"] = "\n<span class='stderr'>run program complete</span>\n"
|
||||||
}
|
}
|
||||||
|
if nil != wsChannel {
|
||||||
wsChannel.WriteJSON(&channelRet)
|
wsChannel.WriteJSON(&channelRet)
|
||||||
wsChannel.Refresh()
|
wsChannel.Refresh()
|
||||||
|
}
|
||||||
}(rand.Int())
|
}(rand.Int())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -109,9 +109,11 @@ func RunHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
if nil != wsChannel {
|
if nil != wsChannel {
|
||||||
channelRet["cmd"] = "run"
|
channelRet["cmd"] = "run"
|
||||||
channelRet["output"] = ""
|
channelRet["output"] = ""
|
||||||
|
if nil != wsChannel {
|
||||||
wsChannel.WriteJSON(&channelRet)
|
wsChannel.WriteJSON(&channelRet)
|
||||||
wsChannel.Refresh()
|
wsChannel.Refresh()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
go func(runningId int) {
|
go func(runningId int) {
|
||||||
defer util.Recover()
|
defer util.Recover()
|
||||||
|
@ -129,9 +131,11 @@ func RunHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
channelRet["cmd"] = "run"
|
channelRet["cmd"] = "run"
|
||||||
channelRet["output"] = oneRuneStr + "\n"
|
channelRet["output"] = oneRuneStr + "\n"
|
||||||
wsChannel := session.OutputWS[sid]
|
wsChannel := session.OutputWS[sid]
|
||||||
|
if nil != wsChannel {
|
||||||
wsChannel.WriteJSON(&channelRet)
|
wsChannel.WriteJSON(&channelRet)
|
||||||
wsChannel.Refresh()
|
wsChannel.Refresh()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
errScanner := bufio.NewScanner(errReader)
|
errScanner := bufio.NewScanner(errReader)
|
||||||
|
@ -142,9 +146,11 @@ func RunHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
channelRet["cmd"] = "run"
|
channelRet["cmd"] = "run"
|
||||||
channelRet["output"] = "<span class='stderr'>" + oneRuneStr + "</span>"
|
channelRet["output"] = "<span class='stderr'>" + oneRuneStr + "</span>"
|
||||||
wsChannel := session.OutputWS[sid]
|
wsChannel := session.OutputWS[sid]
|
||||||
|
if nil != wsChannel {
|
||||||
wsChannel.WriteJSON(&channelRet)
|
wsChannel.WriteJSON(&channelRet)
|
||||||
wsChannel.Refresh()
|
wsChannel.Refresh()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
cmd.Wait()
|
cmd.Wait()
|
||||||
|
|
||||||
|
@ -157,8 +163,10 @@ func RunHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
} else {
|
} else {
|
||||||
channelRet["output"] = "\n<span class='stderr'>run program complete</span>\n"
|
channelRet["output"] = "\n<span class='stderr'>run program complete</span>\n"
|
||||||
}
|
}
|
||||||
|
if nil != wsChannel {
|
||||||
wsChannel.WriteJSON(&channelRet)
|
wsChannel.WriteJSON(&channelRet)
|
||||||
wsChannel.Refresh()
|
wsChannel.Refresh()
|
||||||
|
}
|
||||||
}(rand.Int())
|
}(rand.Int())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue