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