This commit is contained in:
parent
bc9145790c
commit
a8c55a6f9b
|
@ -262,7 +262,30 @@ func BuildHandler(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
if data["succ"].(bool) {
|
||||
if !data["succ"].(bool) {
|
||||
return
|
||||
}
|
||||
|
||||
channelRet := map[string]interface{}{}
|
||||
|
||||
if nil != session.OutputWS[sid] {
|
||||
// 在前端 output 中显示“开始构建”
|
||||
|
||||
channelRet["output"] = "go build"
|
||||
channelRet["cmd"] = "pre-build"
|
||||
|
||||
wsChannel := session.OutputWS[sid]
|
||||
|
||||
err := wsChannel.Conn.WriteJSON(&channelRet)
|
||||
if nil != err {
|
||||
glog.Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
// 更新通道最近使用时间
|
||||
wsChannel.Time = time.Now()
|
||||
}
|
||||
|
||||
reader := io.MultiReader(stdout, stderr)
|
||||
|
||||
if err := cmd.Start(); nil != err {
|
||||
|
@ -362,7 +385,6 @@ func BuildHandler(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
}(rand.Int())
|
||||
}
|
||||
}
|
||||
|
||||
// go install.
|
||||
func GoInstallHandler(w http.ResponseWriter, r *http.Request) {
|
||||
|
|
|
@ -317,6 +317,8 @@ var wide = {
|
|||
});
|
||||
}
|
||||
|
||||
// TODO: 重构成 switch-case
|
||||
|
||||
if ('run' === data.cmd) { // 正在运行
|
||||
wide.fillOutput($('.bottom-window-group .output').text() + data.output);
|
||||
wide.curProcessId = data.pid;
|
||||
|
@ -345,6 +347,8 @@ var wide = {
|
|||
CodeMirror.signal(wide.curEditor, "change", wide.curEditor);
|
||||
} else if ('go get' === data.cmd || 'go install' === data.cmd) {
|
||||
wide.fillOutput($('.bottom-window-group .output').text() + data.output);
|
||||
} else if ('pre-build' === data.cmd) {
|
||||
wide.fillOutput(data.output);
|
||||
}
|
||||
};
|
||||
outputWS.onclose = function (e) {
|
||||
|
|
Loading…
Reference in New Issue