File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -326,6 +326,8 @@ func (c *Cmd) run() {
326326 // who's waiting for us to close them.
327327 if c .stdoutStream != nil {
328328 defer func () {
329+ c .stdoutStream .Flush ()
330+ c .stderrStream .Flush ()
329331 // exec.Cmd.Wait has already waited for all output:
330332 // Otherwise, during the execution of the command a separate goroutine
331333 // reads from the process over a pipe and delivers that data to the
@@ -635,3 +637,11 @@ func (rw *OutputStream) SetLineBufferSize(n int) {
635637 rw .bufSize = n
636638 rw .buf = make ([]byte , rw .bufSize )
637639}
640+
641+ // Flush empties the buffer of its last line.
642+ func (rw * OutputStream ) Flush () {
643+ if rw .lastChar > 0 {
644+ line := string (rw .buf [0 :rw .lastChar ])
645+ rw .streamChan <- line
646+ }
647+ }
You can’t perform that action at this time.
0 commit comments