diff --git a/container_option.go b/container_option.go index bf901a9..b9ead2c 100644 --- a/container_option.go +++ b/container_option.go @@ -72,13 +72,14 @@ // will effectively disable auto refresh rate and discard any output, // useful if you want to disable progress bars with little overhead. func WithOutput(w io.Writer) ContainerOption { + var discarded bool + if w == nil { + w = io.Discard + discarded = true + } return func(s *pState) { - if w == nil { - s.output = io.Discard - s.outputDiscarded = true - return - } s.output = w + s.outputDiscarded = discarded } }