parent
7a255e6772
commit
61f8d214d2
|
@ -144,6 +144,8 @@ func RunHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
go func() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
buf, err := outReader.ReadString('\n')
|
buf, err := outReader.ReadString('\n')
|
||||||
|
buf = strings.Replace(buf, "<", "<", -1)
|
||||||
|
buf = strings.Replace(buf, ">", ">", -1)
|
||||||
|
|
||||||
// TODO: fix the duplicated error
|
// TODO: fix the duplicated error
|
||||||
|
|
||||||
|
@ -155,7 +157,7 @@ func RunHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
if nil != wsChannel {
|
if nil != wsChannel {
|
||||||
channelRet["cmd"] = "run-done"
|
channelRet["cmd"] = "run-done"
|
||||||
channelRet["output"] = "<pre>" + string(buf) + "</pre>"
|
channelRet["output"] = "<pre>" + buf + "</pre>"
|
||||||
err := wsChannel.Conn.WriteJSON(&channelRet)
|
err := wsChannel.Conn.WriteJSON(&channelRet)
|
||||||
if nil != err {
|
if nil != err {
|
||||||
glog.Error(err)
|
glog.Error(err)
|
||||||
|
@ -169,7 +171,7 @@ func RunHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
} else {
|
} else {
|
||||||
if nil != wsChannel {
|
if nil != wsChannel {
|
||||||
channelRet["cmd"] = "run"
|
channelRet["cmd"] = "run"
|
||||||
channelRet["output"] = "<pre>" + string(buf) + "</pre>"
|
channelRet["output"] = "<pre>" + buf + "</pre>"
|
||||||
err := wsChannel.Conn.WriteJSON(&channelRet)
|
err := wsChannel.Conn.WriteJSON(&channelRet)
|
||||||
if nil != err {
|
if nil != err {
|
||||||
glog.Error(err)
|
glog.Error(err)
|
||||||
|
@ -184,6 +186,8 @@ func RunHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
for {
|
for {
|
||||||
buf, err := errReader.ReadString('\n')
|
buf, err := errReader.ReadString('\n')
|
||||||
|
buf = strings.Replace(buf, "<", "<", -1)
|
||||||
|
buf = strings.Replace(buf, ">", ">", -1)
|
||||||
|
|
||||||
if nil != err {
|
if nil != err {
|
||||||
// remove the exited process from user process set
|
// remove the exited process from user process set
|
||||||
|
@ -195,7 +199,7 @@ func RunHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
wsChannel := session.OutputWS[sid]
|
wsChannel := session.OutputWS[sid]
|
||||||
|
|
||||||
channelRet["cmd"] = "run-done"
|
channelRet["cmd"] = "run-done"
|
||||||
channelRet["output"] = "<pre>" + string(buf) + "</pre>"
|
channelRet["output"] = "<pre>" + buf + "</pre>"
|
||||||
err := wsChannel.Conn.WriteJSON(&channelRet)
|
err := wsChannel.Conn.WriteJSON(&channelRet)
|
||||||
if nil != err {
|
if nil != err {
|
||||||
glog.Error(err)
|
glog.Error(err)
|
||||||
|
@ -211,7 +215,7 @@ func RunHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
wsChannel := session.OutputWS[sid]
|
wsChannel := session.OutputWS[sid]
|
||||||
|
|
||||||
channelRet["cmd"] = "run"
|
channelRet["cmd"] = "run"
|
||||||
channelRet["output"] = "<pre>" + string(buf) + "</pre>"
|
channelRet["output"] = "<pre>" + buf + "</pre>"
|
||||||
err := wsChannel.Conn.WriteJSON(&channelRet)
|
err := wsChannel.Conn.WriteJSON(&channelRet)
|
||||||
if nil != err {
|
if nil != err {
|
||||||
glog.Error(err)
|
glog.Error(err)
|
||||||
|
|
Loading…
Reference in New Issue