Skip to content

Commit

Permalink
Merge pull request #1 from nexustar/stderrchan
Browse files Browse the repository at this point in the history
fix slow select
  • Loading branch information
AstroProfundis authored Dec 9, 2021
2 parents d52fc63 + d62284b commit 9910ebd
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions easyssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,11 +357,17 @@ loop:
select {
case isTimeout = <-doneChan:
break loop
case outline := <-stdoutChan:
case outline, ok := <-stdoutChan:
if !ok {
stdoutChan = nil
}
if outline != "" {
outStr += outline + "\n"
}
case errline := <-stderrChan:
case errline, ok := <-stderrChan:
if !ok {
stderrChan = nil
}
if errline != "" {
errStr += errline + "\n"
}
Expand Down

0 comments on commit 9910ebd

Please sign in to comment.