Skip to content

confirm command is ignoring its --timeout option #698

Closed
@dpritchett

Description

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.

Activity

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

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions