Skip to content

Write interactive prompts to stderr and handle echo-disable failures#32393

Open
Mukuwul wants to merge 1 commit into
helm:mainfrom
Mukuwul:fix-prompts-stderr
Open

Write interactive prompts to stderr and handle echo-disable failures#32393
Mukuwul wants to merge 1 commit into
helm:mainfrom
Mukuwul:fix-prompts-stderr

Conversation

@Mukuwul

@Mukuwul Mukuwul commented Jul 19, 2026

Copy link
Copy Markdown

What this PR does / why we need it:

Closes #32392

Moves the interactive prompts from helm registry login (username/password/token) and the signing-key passphrase prompts in helm package / helm plugin package from stdout to stderr, following the docker/kubectl/oras convention so stdout stays machine-readable when captured.

In registry_login.go's readLine it also:

  • returns an error when term.DisableEcho fails instead of silently continuing — previously a failure there meant the password was echoed to the terminal with no warning
  • only attempts echo handling when stdin is actually a terminal, so piped input (echo pw | helm registry login … without --password-stdin) behaves exactly as before — this also means the new DisableEcho error path can't fire for pipes

Special notes for your reviewer:

Behavior-wise stdout consumers only ever saw prompt text (never data) from these paths, so nothing that parses stdout can break; the prompts simply become visible again when stdout is redirected. Verified with go build/go vet on the three packages; the TestPackage failures on my Windows machine are pre-existing portability issues also present on clean main (see #32389).

If applicable:

  • this PR contains user facing changes (the docs needed label should be applied if so)
  • this PR contains unit tests
  • this PR has been tested for backwards compatibility

Interactive prompts from 'helm registry login' (username/password/token)
and the signing-key passphrase prompts in 'helm package' and
'helm plugin package' are printed to stdout. Anyone capturing stdout
(scripts, pipelines) gets prompt text mixed into the output; the
docker/kubectl/oras convention is to keep prompts on stderr so stdout
stays machine-readable.

Also in registry login's readLine:

- the term.DisableEcho error was silently discarded, so a failure to
  disable echo would print the password to the terminal with no
  warning; it now returns an error instead
- echo handling is only attempted when stdin is actually a terminal,
  so piped input (e.g. 'echo pw | helm registry login ...' without
  --password-stdin) keeps working as before

Signed-off-by: Mukul <nmukul32@gmail.com>
Copilot AI review requested due to automatic review settings July 19, 2026 10:33
@pull-request-size pull-request-size Bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jul 19, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates Helm’s interactive CLI prompting behavior so prompts don’t pollute stdout when users capture command output for scripting, aligning helm registry login and signing passphrase prompts with common tooling conventions (docker/kubectl/oras).

Changes:

  • Write helm registry login username/password/token prompts to stderr instead of stdout.
  • Write signing-key passphrase prompts for helm package and helm plugin package to stderr instead of stdout.
  • In readLine (registry login), only attempt echo suppression when stdin is a terminal, and return an error if disabling echo fails (avoiding silent password echo).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
pkg/cmd/registry_login.go Routes prompts/newlines to stderr and tightens terminal echo-disable behavior in readLine.
pkg/cmd/plugin_package.go Sends signing passphrase prompt/newline to stderr to keep stdout machine-readable.
pkg/action/package.go Sends signing passphrase prompt/newline to stderr for helm package --sign flows.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Interactive prompts (registry login, signing passphrase) are written to stdout instead of stderr

2 participants