my ( $confirm, $skip ) = ( ' Confirm', ' Skip' ); my $tc = Term::Choose.new(); my $choice; my $timeout = Promise.in( 50 ).then({ $choice = $confirm; $tc.end-term(); # 1 $tc.reset-term(); # 2 $tc.restore-term(); # 3 }); my $code = start { $choice = $tc.choose( ( Str, $confirm, $skip ), :undef( ' Exit' ) ); } await Promise.anyof( $timeout, $code ); if ! $choice.defined { ... } elsif $choice eq $confirm { ... } elsif $choice eq $skip { ... }