Revert "only draw ui when the output pauses in shell-pipe"

This reverts commit 8229d972b9.
This commit is contained in:
Gokcehan committed 2018-12-03 15:43:12 +03:00
1 parent c693b7eae4
commit b101603a4a
1 file changed
+8 -27
+8 -27
View File
@@ -335,34 +335,15 @@ func (app *app) runShell(s string, args []string, prefix string) {
app.ui.cmdPrefix = ">"
reader := bufio.NewReader(out)
bytes := make(chan byte, 1000)
go func() {
for {
b, err := reader.ReadByte()
if err == io.EOF {
break
}
bytes <- b
}
close(bytes)
}()
loop:
for {
select {
case b, ok := <-bytes:
switch {
case !ok:
break loop
case b == '\n' || b == '\r':
app.ui.exprChan <- &callExpr{"echo", []string{string(app.cmdOutBuf)}, 1}
app.cmdOutBuf = nil
default:
app.cmdOutBuf = append(app.cmdOutBuf, b)
}
default:
app.ui.exprChan <- &callExpr{"echo", []string{string(app.cmdOutBuf)}, 1}
b, err := reader.ReadByte()
if err == io.EOF {
break
}
app.cmdOutBuf = append(app.cmdOutBuf, b)
app.ui.exprChan <- &callExpr{"echo", []string{string(app.cmdOutBuf)}, 1}
if b == '\n' || b == '\r' {
app.cmdOutBuf = nil
}
}