Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

confirm command is ignoring its --timeout option #698

Open
dpritchett opened this issue Oct 31, 2024 · 0 comments · May be fixed by #697
Open

confirm command is ignoring its --timeout option #698

dpritchett opened this issue Oct 31, 2024 · 0 comments · May be fixed by #697

Comments

@dpritchett
Copy link

dpritchett commented Oct 31, 2024

Describe the bug

gum confirm --timeout never times out despite having a documented --timeout option.

Relevant excerpts from gum confirm --help

Usage: gum confirm [<prompt>] [flags]

Ask a user to confirm an action

Arguments:
  [<prompt>]    Prompt to display.

Flags:
     --default              Default confirmation action
     --timeout=0            Timeout until confirm returns selected value or default if provided ($GUM_CONFIRM_TIMEOUT)

To Reproduce
Steps to reproduce the behavior:

This never times out:

gum confirm --timeout=1s && echo "timed out"

Repro but it's a .tape file:

Set TypingSpeed 0.1
Output broken-main.gif
Set Shell zsh
Sleep 500ms
Type "git checkout main && git fetch upstream main && git rev-parse HEAD"
Enter
Type "date +%H:%M:%S.%1N && go run . confirm --timeout=1s --default='Yes' && echo 'Success'"
Enter
Sleep 4s
Ctrl+C
Type "date +%H:%M:%S.%1N"
Enter
Sleep 4s
Ctrl+D

Expected behavior
Confirm times out after the specified duration as described in the docs.

./gum confirm --timeout=1s && echo "timed out"
┃  Are you sure?

┃     Yes        No

timed out

Screenshots

Before

Gum timeout wrapped in an external timeout command. See that it does not stop at 1 second but stops at 5 per the wrapping command:

image

After (using fix from #697)

Same call as before but gum times out at 1 second as expected:

image

Desktop (please complete the following information):

  • OS: MacOS
  • Browser: uhh.. alacritty is my terminal emulator, fish my shell
  • Version: MacOS 15.0.1 (24A348)

Additional context

I have a unit tested fix up in #697.

@dpritchett dpritchett changed the title Confirm command ignores its --timeout option confirm command is ignoring its --timeout option Oct 31, 2024
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 a pull request may close this issue.

1 participant