Skip to content

Fix newline output for empty stdin prompts - #1654

Open
ychampion wants to merge 1 commit into
trifectatechfoundation:mainfrom
ychampion:fix-empty-stdin-prompt-newline
Open

Fix newline output for empty stdin prompts#1654
ychampion wants to merge 1 commit into
trifectatechfoundation:mainfrom
ychampion:fix-empty-stdin-prompt-newline

Conversation

@ychampion

Copy link
Copy Markdown

Describe the changes done on this pull request

Password input cleanup now writes a trailing newline only when a prompt or feedback was displayed. This keeps sudo -S -p '' stderr empty while preserving visible prompt cleanup.

The regressions assert raw sink bytes because the compliance harness removes one trailing newline, and include a non-empty prompt control.

Fixes #1648.

Validation

  • cargo test prompt_ --release
  • cargo clippy --no-deps --all-targets -- --deny warnings
  • cargo fmt --all -- --check

Pull Request Checklist

  • I have read and accepted the code of conduct for this project.
  • I have tested, formatted and ran clippy over my changes.
  • I have commented and documented my changes.
  • This pull request fixes issue sudo -S -p '' writes a newline to stderr #1648, where the expected behavior and likely code path were documented.

Only terminate the password UI line when a prompt or feedback was displayed. This keeps stderr empty for promptless stdin authentication while preserving normal prompt cleanup.

Fixes trifectatechfoundation#1648

Constraint: Preserve cleanup for visible prompts and password feedback
Confidence: high
Scope-risk: narrow
Tested: cargo test prompt_ --release; cargo clippy --no-deps --all-targets -- --deny warnings; cargo fmt --all -- --check
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.

sudo -S -p '' writes a newline to stderr

1 participant