构建&运行

This commit is contained in:
Liang Ding 2014-10-16 09:53:22 +08:00
parent 50700a08a7
commit d5360af414
1 changed files with 4 additions and 4 deletions

View File

@ -209,14 +209,14 @@ func BuildHandler(w http.ResponseWriter, r *http.Request) {
suffix = ".exe"
}
executable := "main" + suffix
argv := []string{"build", "-o", executable, filePath}
argv := []string{"build", "-o", executable}
cmd := exec.Command("go", argv...)
cmd.Dir = curDir
setCmdEnv(cmd, username)
glog.V(5).Infof("go build -o %s %s", executable, filePath)
glog.V(5).Infof("go build -o %s", executable)
executable = curDir + conf.PathSeparator + executable
@ -259,7 +259,7 @@ func BuildHandler(w http.ResponseWriter, r *http.Request) {
defer util.Recover()
defer cmd.Wait()
glog.V(3).Infof("Session [%s] is building [id=%d, file=%s]", sid, runningId, filePath)
glog.V(3).Infof("Session [%s] is building [id=%d, dir=%s]", sid, runningId, curDir)
// 一次性读取
buf := make([]byte, 1024*8)
@ -331,7 +331,7 @@ func BuildHandler(w http.ResponseWriter, r *http.Request) {
}
if nil != session.OutputWS[sid] {
glog.V(3).Infof("Session [%s] 's build [id=%d, file=%s] has done", sid, runningId, filePath)
glog.V(3).Infof("Session [%s] 's build [id=%d, dir=%s] has done", sid, runningId, curDir)
wsChannel := session.OutputWS[sid]
err := wsChannel.Conn.WriteJSON(&channelRet)