-
-
Notifications
You must be signed in to change notification settings - Fork 409
Description
Description
Between 6.x and 7.0, when the CLI and logging stuff was rewritten, it appears that the --quiet argument's function got lost. It's still parsed and stored in the options when argparse processes the command line for sopel start, sopel stop, etc., but the opts.quiet flag is never used.
Even in the current master branch, using sopel.cli.run.command_start() as an example (the other subcommands are similar), opts is passed to the get_configuration() helper and then the only remaining reference to it is here:
Lines 327 to 330 in 94065d7
| if opts.daemonize: | |
| child_pid = os.fork() | |
| if child_pid != 0: | |
| return |
However, note the following run_script.py code from 6.x, which uses OutputRedirect (a now-unused class that was just formally marked deprecated in #2385):
Lines 152 to 153 in 592735d
| sys.stderr = tools.OutputRedirect(logfile, True, opts.quiet) | |
| sys.stdout = tools.OutputRedirect(logfile, False, opts.quiet) |
It looks like this goes all the way back to #1678, and has therefore been broken since 7.0.0. That's when the output redirection was replaced by a setup function (sopel.logger.setup_logging()) that takes only the bot's Config into account and does not receive any arguments from the CLI.
Reproduction steps
- Run
sopel start --quiet - The bot prints output to the terminal
Expected behavior
The bot should not print output to the terminal; help text for --quiet says that it should "Suppress all output".
Relevant logs
No response
Notes
It's funny that we have tests to make sure the --quiet argument is parsed and present in the resulting opts object, but never got around to a functional test that actually checks whether it quiets the bot's output.
I guess how long it took to discover this shows you just how few people actually use --quiet… including me. (#1678 was merged over 3 years ago.) Before tonight, I have no idea when or even if I've ever used that flag.
In the end, we need to either fix it in 8.0 or remove it entirely.
Sopel version
Installation method
pip install
Python version
No response
Operating system
No response
IRCd
No response
Relevant plugins
No response