mirror of https://github.com/docker/cli.git
Avoid loop when discarding contents of progress pipe
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
This commit is contained in:
parent
103bfb2739
commit
51f698337d
|
@ -2,6 +2,7 @@ package service
|
|||
|
||||
import (
|
||||
"io"
|
||||
"io/ioutil"
|
||||
|
||||
"github.com/docker/cli/cli/command"
|
||||
"github.com/docker/cli/cli/command/service/progress"
|
||||
|
@ -20,14 +21,7 @@ func waitOnService(ctx context.Context, dockerCli *command.DockerCli, serviceID
|
|||
}()
|
||||
|
||||
if opts.quiet {
|
||||
go func() {
|
||||
for {
|
||||
var buf [1024]byte
|
||||
if _, err := pipeReader.Read(buf[:]); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}()
|
||||
go io.Copy(ioutil.Discard, pipeReader)
|
||||
return <-errChan
|
||||
}
|
||||
|
||||
|
|
|
@ -102,13 +102,7 @@ func runRotateCA(dockerCli command.Cli, flags *pflag.FlagSet, opts caOptions) er
|
|||
}()
|
||||
|
||||
if opts.quiet {
|
||||
go func() {
|
||||
for {
|
||||
if _, err := io.Copy(ioutil.Discard, pipeReader); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}()
|
||||
go io.Copy(ioutil.Discard, pipeReader)
|
||||
return <-errChan
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue