Repository navigation
fix(cli): return after printing help in creds command - #6203
lingyicute wants to merge 1 commit into
Conversation
ReenigneArcher
left a comment
There was a problem hiding this comment.
The early return fixes the missing-argument and explicit-help paths. Please isolate the credentials file per test and verify that each help path prints usage. The creds declaration should also document when usage is printed.
I rebuilt the two changed files with MSYS2 UCRT64 and linked them against the existing Windows build. All seven focused tests passed on the PR and with the proposed test changes. SonarCloud, Read the Docs, and Semantic PR passed. CI, CodeQL, and common lint are awaiting maintainer approval.
Review completed by Codex | Model: gpt-6.2-sol | Thinking: xhigh
Signed-off-by: lingyicute <xlyxinglinyi@gmail.com>
|
Thanks for the review! I've pushed a new commit addressing all points. |
|



Description
Return early from
args::creds()after callinghelp(name)when fewer than two arguments are provided or either argument is"help".Previously,
args::creds()calledhelp(name)without returning and fell through tohttp::save_user_creds(config::sunshine.credentials_file, argv[0], argv[1]), which dereferencednullptr(or read pastargv) when arguments were missing and overwrote stored credentials when"help"was passed.Screenshot
Issues Fixed or Closed
Roadmap Issues
Testing
CredsCommandTestunit tests intests/unit/test_entry_handler.cppcovering missing arguments (argc == 0andargc == 1), explicithelparguments, and valid credential saving.g++on Linux that unpatchedargs::credsthrowsstd::logic_erroron missing arguments and writes credentials onhelp, while the patched version passes all assertions.Type of Change
Checklist
AI Usage
See our AI usage policy.