sg: wait for cmd readers to close before waiting on cmd
Created by: mrnugget
The docs say that calling cmd.Wait()
before waiting for the readers to
close is incorrect:
Wait
will close the pipe after seeing the command exit, so most callers need not close the pipe themselves. It is thus incorrect to callWait
before all reads from the pipe have completed. For the same reason, it is incorrect to callRun
when usingStdoutPipe
. See the example for idiomatic usage.