Simple flag to avoid unnecessary output when using inside scripts.
Rationale: Why do many commands provide a “quiet” option?
We can handle this by replacing our env.stdout and env.stderr with os.devnull at the appropriate moment. Instead of touching os.devnull directly at runtime, though, it should be added as Environment.devnull like we do with the standard streams:
…and from that point only reference env.devnull. This will make it possible to write good tests. So basically there should only be one conditional somewhere and all existing behavior should remain intact.
What should the flag be?
@paulolieuthier --quiet sounds pretty standard
The replacement should probably happen here:
Hey! Is someone working on this issue or can it be taken?
@nb2838 I’m not. So, unless @paulolieuthier is looking into this, it should be up for grabs.
Go ahead @nb2838! I'm looking forward to the release :)
@nb2838 Are you still working on this? I'd like to pick up this issue if not!
Yes currently working on it :)
I've been working on the problem and I think I have a working solution. My only problem thus far is that I don't know at which point precisely to close the os.devnull file. If I don't close it and let the job be done by the garbage collectore my code works fine. However, when I try closing it by adding a
finally:
env.dev.null.close()
at the end of main in core.py I get an error if I use --download option. I was wondering if you have any suggestions for dealing with this issue.
@nb2838 please open a PR and I’ll take a look
Most helpful comment
Yes currently working on it :)