Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: qvm-ls outputs to stderr for --help-* calls #254

Merged
merged 1 commit into from
Aug 20, 2023

Conversation

jamke
Copy link
Contributor

@jamke jamke commented Aug 8, 2023

The problem is that ArgumentParser has no ability to provide output file for exit() calls. In the ArgumentParser documentation [1] there is even no information about output target file (stderr or stdout) for ArgumentParser.exit() functions, but from the source code of argparse [2] it is obvious that it always outputs message to stderr which is not desired in our case. [1]: https://docs.python.org/3/library/argparse.html#exiting-methods [2]: https://github.com/python/cpython/blob/3.11/Lib/argparse.py#L2612

I have tested this patch on my system, it works as expected.

Fixes QubesOS/qubes-issues#8408

The problem is that ArgumentParser has no ability to provide output file for exit() calls. In the ArgumentParser documentation [1] there is even no information about output target file (stderr or stdout) for ArgumentParser.exit() functions, but from the source code of argparse [2] it is obvious that it always outputs message to stderr which is not desired in our case.
[1]: https://docs.python.org/3/library/argparse.html#exiting-methods
[2]: https://github.com/python/cpython/blob/3.11/Lib/argparse.py#L2612

I have tested this patch on my system, it works as expected.

Fixes QubesOS/qubes-issues#8408
@marmarek
Copy link
Member

PipelineRetry

@codecov
Copy link

codecov bot commented Aug 18, 2023

Codecov Report

Merging #254 (2cc0898) into main (4023ee2) will increase coverage by 0.28%.
Report is 4 commits behind head on main.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##             main     #254      +/-   ##
==========================================
+ Coverage   75.12%   75.40%   +0.28%     
==========================================
  Files          51       51              
  Lines        7806     8454     +648     
==========================================
+ Hits         5864     6375     +511     
- Misses       1942     2079     +137     
Files Changed Coverage Δ
qubesadmin/tools/qvm_ls.py 80.70% <0.00%> (+2.68%) ⬆️

... and 4 files with indirect coverage changes

@marmarek marmarek merged commit c380412 into QubesOS:main Aug 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

qvm-ls --help-formats and qvm-ls --help-columns output to stderr
2 participants