Skip to content

fix(interactive): prevent looping forever when input cannot be read - #112

Open
npmania wants to merge 1 commit into
postfinance:mainfrom
npmania:fix/confirm-prompt-eof
Open

fix(interactive): prevent looping forever when input cannot be read#112
npmania wants to merge 1 commit into
postfinance:mainfrom
npmania:fix/confirm-prompt-eof

Conversation

@npmania

@npmania npmania commented Aug 13, 2026

Copy link
Copy Markdown

ConfirmPrompt discards the error from ReadString, so when there's no readable input the empty string hits default and loops forever.

Non-interactive runs that reach a prompt will spin. In my case topf nodes with stdin closed hit No secrets.yaml found for cluster X. Generate a new one? and wrote 575MB in 8 seconds. apply, reset, upgrade share the confirm prompt.

Not applying errors.Is(err, io.EOF) since a closed fd or a detached tty will give os.ErrClosed and EIO, which loop just the same. It will end up having to cover all kinds of cases that can occur in different environments.

I have put the check after the switch so printf 'y' | topf still works, because ReadString returns the data and io.EOF together.

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.

1 participant