This commit is contained in:
parent
e97ce75b92
commit
7deb7c60e5
2
main.go
2
main.go
|
@ -174,7 +174,7 @@ func main() {
|
|||
http.HandleFunc(conf.Wide.Context+"/playground/save", handlerWrapper(playground.SaveHandler))
|
||||
http.HandleFunc(conf.Wide.Context+"/playground/short-url", handlerWrapper(playground.ShortURLHandler))
|
||||
http.HandleFunc(conf.Wide.Context+"/playground/build", handlerWrapper(playground.BuildHandler))
|
||||
http.HandleFunc(conf.Wide.Context+"/playground/run", handlerWrapper(playground.RunHandler))
|
||||
http.HandleFunc(conf.Wide.Context+"/playground/run", handlerWrapper(output.RunHandler))
|
||||
http.HandleFunc(conf.Wide.Context+"/playground/stop", handlerWrapper(playground.StopHandler))
|
||||
http.HandleFunc(conf.Wide.Context+"/playground/autocomplete", handlerWrapper(playground.AutocompleteHandler))
|
||||
|
||||
|
|
|
@ -188,6 +188,7 @@ func BuildHandler(w http.ResponseWriter, r *http.Request) {
|
|||
err = wsChannel.WriteJSON(&channelRet)
|
||||
if nil != err {
|
||||
logger.Warn(err)
|
||||
|
||||
break
|
||||
}
|
||||
|
||||
|
|
|
@ -111,13 +111,17 @@ func RunHandler(w http.ResponseWriter, r *http.Request) {
|
|||
go func() {
|
||||
defer util.Recover()
|
||||
|
||||
outScanner := bufio.NewScanner(outReader)
|
||||
for outScanner.Scan() {
|
||||
oneRuneStr := outScanner.Text()
|
||||
for {
|
||||
r, _, err := outReader.ReadRune()
|
||||
if nil != err {
|
||||
break
|
||||
}
|
||||
|
||||
oneRuneStr := string(r)
|
||||
oneRuneStr = strings.Replace(oneRuneStr, "<", "<", -1)
|
||||
oneRuneStr = strings.Replace(oneRuneStr, ">", ">", -1)
|
||||
channelRet["cmd"] = "run"
|
||||
channelRet["output"] = oneRuneStr + "\n"
|
||||
channelRet["output"] = oneRuneStr
|
||||
wsChannel := session.OutputWS[sid]
|
||||
if nil != wsChannel {
|
||||
wsChannel.WriteJSON(&channelRet)
|
||||
|
@ -126,9 +130,13 @@ func RunHandler(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
}()
|
||||
|
||||
errScanner := bufio.NewScanner(errReader)
|
||||
for errScanner.Scan() {
|
||||
oneRuneStr := errScanner.Text()
|
||||
for {
|
||||
r, _, err := errReader.ReadRune()
|
||||
if nil != err {
|
||||
break
|
||||
}
|
||||
|
||||
oneRuneStr := string(r)
|
||||
oneRuneStr = strings.Replace(oneRuneStr, "<", "<", -1)
|
||||
oneRuneStr = strings.Replace(oneRuneStr, ">", ">", -1)
|
||||
channelRet["cmd"] = "run"
|
||||
|
|
|
@ -123,13 +123,17 @@ func RunHandler(w http.ResponseWriter, r *http.Request) {
|
|||
go func() {
|
||||
defer util.Recover()
|
||||
|
||||
outScanner := bufio.NewScanner(outReader)
|
||||
for outScanner.Scan() {
|
||||
oneRuneStr := outScanner.Text()
|
||||
for {
|
||||
r, _, err := outReader.ReadRune()
|
||||
if nil != err {
|
||||
break
|
||||
}
|
||||
|
||||
oneRuneStr := string(r)
|
||||
oneRuneStr = strings.Replace(oneRuneStr, "<", "<", -1)
|
||||
oneRuneStr = strings.Replace(oneRuneStr, ">", ">", -1)
|
||||
channelRet["cmd"] = "run"
|
||||
channelRet["output"] = oneRuneStr + "\n"
|
||||
channelRet["output"] = oneRuneStr
|
||||
wsChannel := session.OutputWS[sid]
|
||||
if nil != wsChannel {
|
||||
wsChannel.WriteJSON(&channelRet)
|
||||
|
@ -138,9 +142,13 @@ func RunHandler(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
}()
|
||||
|
||||
errScanner := bufio.NewScanner(errReader)
|
||||
for errScanner.Scan() {
|
||||
oneRuneStr := errScanner.Text()
|
||||
for {
|
||||
r, _, err := errReader.ReadRune()
|
||||
if nil != err {
|
||||
break
|
||||
}
|
||||
|
||||
oneRuneStr := string(r)
|
||||
oneRuneStr = strings.Replace(oneRuneStr, "<", "<", -1)
|
||||
oneRuneStr = strings.Replace(oneRuneStr, ">", ">", -1)
|
||||
channelRet["cmd"] = "run"
|
||||
|
|
Loading…
Reference in New Issue