diff --git a/cli/command/service/helpers.go b/cli/command/service/helpers.go index 50aee7c88f..2e893f96e1 100644 --- a/cli/command/service/helpers.go +++ b/cli/command/service/helpers.go @@ -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 } diff --git a/cli/command/swarm/ca.go b/cli/command/swarm/ca.go index 0814a53950..fab0929b64 100644 --- a/cli/command/swarm/ca.go +++ b/cli/command/swarm/ca.go @@ -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 }