keepassxc icon indicating copy to clipboard operation
keepassxc copied to clipboard

CLI quiet mode - write database unlock errors to stderr

Open droidmonkey opened this issue 4 months ago • 8 comments

  • Fixes #12402

Testing strategy

Updated test cases to account for password prompt being written to stderr in quiet mode

Type of change

  • ✅ Bug fix (non-breaking change that fixes an issue)

droidmonkey avatar Aug 20 '25 00:08 droidmonkey

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 64.20%. Comparing base (8d59090) to head (01a1982). :warning: Report is 53 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #12403      +/-   ##
===========================================
+ Coverage    64.19%   64.20%   +0.01%     
===========================================
  Files          376      376              
  Lines        39371    39371              
===========================================
+ Hits         25273    25275       +2     
+ Misses       14098    14096       -2     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Aug 20 '25 00:08 codecov[bot]

It is writing the unlock prompt to stderr right now by default 😅. When in quiet mode is just doesn't write the prompt at all, which doesn't make sense.

The point of quiet mode is that nothing but data is written to stdout

droidmonkey avatar Aug 20 '25 10:08 droidmonkey

It is writing the unlock prompt to stderr right now by default 😅. When in quiet mode is just doesn't write the prompt at all, which doesn't make sense.

The point of quiet mode is that nothing but data is written to stdout

That was a bit unclear for me, because I thought only the errors should be written in quiet mode, not the password prompt. So if you are absolutely certain about this, go ahead.

varjolintu avatar Aug 20 '25 10:08 varjolintu

I'd like to get @phoerious opinion, too.

droidmonkey avatar Aug 20 '25 10:08 droidmonkey

IMHO, stdout should always be for anything that is payload data that you'd want to pipe somewhere or write to a file and stderr for anything that isn't, such as error and status messages. The prompt should be stderr as well. --quiet should suppress everything.

phoerious avatar Aug 20 '25 11:08 phoerious

The prompt should be stderr as well. --quiet should suppress everything

Even errors?

droidmonkey avatar Aug 20 '25 11:08 droidmonkey

Errors should be communicated via return codes. What we could also do is -q for no output and -qq for no error output.

phoerious avatar Aug 20 '25 14:08 phoerious

That is a decent idea, I'll see what I can do here.

droidmonkey avatar Aug 20 '25 22:08 droidmonkey