diff --git a/output/outputs.go b/output/outputs.go
index 66e4f10..8bfabda 100644
--- a/output/outputs.go
+++ b/output/outputs.go
@@ -105,9 +105,8 @@ func RunHandler(w http.ResponseWriter, r *http.Request) {
data["succ"] = false
}
- //outReader := bufio.NewReader(stdout)
outReader := util.NewReader(stdout)
- errReader := bufio.NewReader(stderr)
+ errReader := util.NewReader(stderr)
if err := cmd.Start(); nil != err {
glog.Error(err)
@@ -162,7 +161,6 @@ func RunHandler(w http.ResponseWriter, r *http.Request) {
go func() {
for {
buf, err := outReader.ReadData()
- //buf, err := outReader.ReadString('\n')
buf = strings.Replace(buf, "<", "<", -1)
buf = strings.Replace(buf, ">", ">", -1)
@@ -204,45 +202,43 @@ func RunHandler(w http.ResponseWriter, r *http.Request) {
}()
for {
- buf, err := errReader.ReadString('\n')
+ buf, err := errReader.ReadData()
buf = strings.Replace(buf, "<", "<", -1)
buf = strings.Replace(buf, ">", ">", -1)
+ if nil == session.OutputWS[sid] {
+ break
+ }
+
+ wsChannel := session.OutputWS[sid]
+
if nil != err {
// remove the exited process from user process set
processes.remove(wSession, cmd.Process)
glog.V(5).Infof("Session [%s] 's running [id=%d, file=%s] has done [stderr err]", sid, runningId, filePath)
- if nil != session.OutputWS[sid] {
- wsChannel := session.OutputWS[sid]
-
- channelRet["cmd"] = "run-done"
- channelRet["output"] = buf
- err := wsChannel.WriteJSON(&channelRet)
- if nil != err {
- glog.Error(err)
- break
- }
-
- wsChannel.Refresh()
+ channelRet["cmd"] = "run-done"
+ channelRet["output"] = "" + buf + ""
+ err := wsChannel.WriteJSON(&channelRet)
+ if nil != err {
+ glog.Error(err)
+ break
}
+ wsChannel.Refresh()
+
break
} else {
- if nil != session.OutputWS[sid] {
- wsChannel := session.OutputWS[sid]
-
- channelRet["cmd"] = "run"
- channelRet["output"] = buf
- err := wsChannel.WriteJSON(&channelRet)
- if nil != err {
- glog.Error(err)
- break
- }
-
- wsChannel.Refresh()
+ channelRet["cmd"] = "run"
+ channelRet["output"] = "" + buf + ""
+ err := wsChannel.WriteJSON(&channelRet)
+ if nil != err {
+ glog.Error(err)
+ break
}
+
+ wsChannel.Refresh()
}
}
}(rand.Int())
@@ -391,7 +387,8 @@ func BuildHandler(w http.ResponseWriter, r *http.Request) {
// build gutter lint
errOut := string(buf)
- channelRet["output"] = "" + i18n.Get(locale, "build-error").(string) + "\n" + errOut
+ channelRet["output"] = "" + i18n.Get(locale, "build-error").(string) + "\n" +
+ "" + errOut + ""
lines := strings.Split(errOut, "\n")
diff --git a/static/css/wide.css b/static/css/wide.css
index 5f5e6d6..355edb2 100644
--- a/static/css/wide.css
+++ b/static/css/wide.css
@@ -322,6 +322,11 @@
color: #9d0000;
}
+.bottom-window-group .output .stderr {
+ color: gray;
+ font-style: italic;
+}
+
.bottom-window-group table {
width: 100%;
}