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 (
|
import (
|
||||||
"io"
|
"io"
|
||||||
|
"io/ioutil"
|
||||||
|
|
||||||
"github.com/docker/cli/cli/command"
|
"github.com/docker/cli/cli/command"
|
||||||
"github.com/docker/cli/cli/command/service/progress"
|
"github.com/docker/cli/cli/command/service/progress"
|
||||||
@ -20,14 +21,7 @@ func waitOnService(ctx context.Context, dockerCli *command.DockerCli, serviceID
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
if opts.quiet {
|
if opts.quiet {
|
||||||
go func() {
|
go io.Copy(ioutil.Discard, pipeReader)
|
||||||
for {
|
|
||||||
var buf [1024]byte
|
|
||||||
if _, err := pipeReader.Read(buf[:]); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return <-errChan
|
return <-errChan
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,13 +102,7 @@ func runRotateCA(dockerCli command.Cli, flags *pflag.FlagSet, opts caOptions) er
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
if opts.quiet {
|
if opts.quiet {
|
||||||
go func() {
|
go io.Copy(ioutil.Discard, pipeReader)
|
||||||
for {
|
|
||||||
if _, err := io.Copy(ioutil.Discard, pipeReader); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return <-errChan
|
return <-errChan
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user