Merge branch 'master' of https://github.com/b3log/wide
Conflicts: output/outputs.go
This commit is contained in:
commit
7cf4376489
|
@ -146,7 +146,7 @@ func RunHandler(w http.ResponseWriter, r *http.Request) {
|
|||
wsChannel := session.OutputWS[sid]
|
||||
|
||||
channelRet["cmd"] = "run-done"
|
||||
channelRet["output"] = string(buf[:count])
|
||||
channelRet["output"] = "<pre>" + string(buf[:count]) + "</pre>"
|
||||
err := wsChannel.Conn.WriteJSON(&channelRet)
|
||||
if nil != err {
|
||||
glog.Error(err)
|
||||
|
@ -163,7 +163,7 @@ func RunHandler(w http.ResponseWriter, r *http.Request) {
|
|||
wsChannel := session.OutputWS[sid]
|
||||
|
||||
channelRet["cmd"] = "run"
|
||||
channelRet["output"] = string(buf[:count])
|
||||
channelRet["output"] = "<pre>" + string(buf[:count]) + "</pre>"
|
||||
err := wsChannel.Conn.WriteJSON(&channelRet)
|
||||
if nil != err {
|
||||
glog.Error(err)
|
||||
|
@ -272,7 +272,7 @@ func BuildHandler(w http.ResponseWriter, r *http.Request) {
|
|||
if nil != session.OutputWS[sid] {
|
||||
// 在前端 output 中显示“开始构建”
|
||||
|
||||
channelRet["output"] = "<span>" + i18n.Get(r, "start-build").(string) + "</span>\n"
|
||||
channelRet["output"] = "<span class='start-build'>" + i18n.Get(r, "start-build").(string) + "</span>\n"
|
||||
channelRet["cmd"] = "start-build"
|
||||
|
||||
wsChannel := session.OutputWS[sid]
|
||||
|
@ -313,7 +313,7 @@ func BuildHandler(w http.ResponseWriter, r *http.Request) {
|
|||
if 0 == count { // 说明构建成功,没有错误信息输出
|
||||
// 设置下一次执行命令(前端会根据该参数发送请求)
|
||||
channelRet["nextCmd"] = args["nextCmd"]
|
||||
channelRet["output"] = i18n.Get(r, "build-succ").(string) + "\n"
|
||||
channelRet["output"] = "<span class='build-succ'>" + i18n.Get(r, "build-succ").(string) + "</span>\n"
|
||||
|
||||
go func() { // 运行 go install,生成的库用于 gocode lib-path
|
||||
cmd := exec.Command("go", "install")
|
||||
|
@ -329,7 +329,7 @@ func BuildHandler(w http.ResponseWriter, r *http.Request) {
|
|||
} else { // 构建失败
|
||||
// 解析错误信息,返回给编辑器 gutter lint
|
||||
errOut := string(buf[:count])
|
||||
channelRet["output"] = i18n.Get(r, "build-failed").(string) + "\n" + errOut
|
||||
channelRet["output"] = "<span class='build-failed'>" + i18n.Get(r, "build-failed").(string) + "</span>\n" + errOut
|
||||
|
||||
lines := strings.Split(errOut, "\n")
|
||||
|
||||
|
@ -465,7 +465,7 @@ func GoInstallHandler(w http.ResponseWriter, r *http.Request) {
|
|||
if nil != session.OutputWS[sid] {
|
||||
// 在前端 output 中显示“开始 go install”
|
||||
|
||||
channelRet["output"] = i18n.Get(r, "start-install").(string) + "\n"
|
||||
channelRet["output"] = "<span class='start-install'>" + i18n.Get(r, "start-install").(string) + "</span>\n"
|
||||
channelRet["cmd"] = "start-install"
|
||||
|
||||
wsChannel := session.OutputWS[sid]
|
||||
|
@ -500,7 +500,6 @@ func GoInstallHandler(w http.ResponseWriter, r *http.Request) {
|
|||
count, _ := reader.Read(buf)
|
||||
|
||||
channelRet := map[string]interface{}{}
|
||||
|
||||
channelRet["cmd"] = "go install"
|
||||
|
||||
if 0 != count { // 构建失败
|
||||
|
@ -547,9 +546,9 @@ func GoInstallHandler(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
channelRet["lints"] = lints
|
||||
|
||||
channelRet["output"] = i18n.Get(r, "install-failed").(string) + "\n" + errOut
|
||||
channelRet["output"] = "<span class='install-failed'>" + i18n.Get(r, "install-failed").(string) + "</span>\n" + errOut
|
||||
} else {
|
||||
channelRet["output"] = i18n.Get(r, "install-succ").(string) + "\n"
|
||||
channelRet["output"] = "<span class='install-succ'>" + i18n.Get(r, "install-succ").(string) + "</span>\n"
|
||||
}
|
||||
|
||||
if nil != session.OutputWS[sid] {
|
||||
|
@ -622,7 +621,7 @@ func GoGetHandler(w http.ResponseWriter, r *http.Request) {
|
|||
if nil != session.OutputWS[sid] {
|
||||
// 在前端 output 中显示“开始 go get
|
||||
|
||||
channelRet["output"] = i18n.Get(r, "start-get").(string) + "\n"
|
||||
channelRet["output"] = "<span class='start-get'>" + i18n.Get(r, "start-get").(string) + "</span>\n"
|
||||
channelRet["cmd"] = "start-get"
|
||||
|
||||
wsChannel := session.OutputWS[sid]
|
||||
|
@ -664,7 +663,7 @@ func GoGetHandler(w http.ResponseWriter, r *http.Request) {
|
|||
if nil != err {
|
||||
glog.V(3).Infof("Session [%s] 's running [go get] [runningId=%d] has done (with error)", sid, runningId)
|
||||
|
||||
channelRet["output"] = i18n.Get(r, "get-failed").(string) + "\n" + string(buf[:count])
|
||||
channelRet["output"] = "<span class='get-failed'>" + i18n.Get(r, "get-failed").(string) + "</span>\n" + string(buf[:count])
|
||||
|
||||
if nil != session.OutputWS[sid] {
|
||||
wsChannel := session.OutputWS[sid]
|
||||
|
@ -685,7 +684,7 @@ func GoGetHandler(w http.ResponseWriter, r *http.Request) {
|
|||
if 0 == count {
|
||||
glog.V(3).Infof("Session [%s] 's running [go get] [runningId=%d] has done", sid, runningId)
|
||||
|
||||
channelRet["output"] = i18n.Get(r, "get-succ").(string) + "\n"
|
||||
channelRet["output"] = "<span class='get-succ'>" + i18n.Get(r, "get-succ").(string) + "</span>\n"
|
||||
|
||||
if nil != session.OutputWS[sid] {
|
||||
wsChannel := session.OutputWS[sid]
|
||||
|
|
Loading…
Reference in New Issue