microsoft / microsoft/terminal

Pause command in a batch file is sometimes skipped if it is preceded by a choice command

Open
#9,966 3 comments 0 reactions 0 assignees View on GitHub
Area-Input Area-TerminalControl Issue-Bug Priority-3 Product-Terminal
Dominant language
C++
Stars
105k
Forks
9.6k
Avg merge
3d 17h
Merged PRs (30d)
29

Description

### Windows Terminal version (or Windows build number)

1.8.1032.0

### Other Software

_No response_

### Steps to reproduce

Execute this batch file repeatedly in the terminal:
``` bat
@echo off & setlocal

choice /m "The illusion of choice"

pause
```

### Expected Behavior

After pressing y or n to answer the choice, execution should be paused until another key is pressed

### Actual Behavior

Sometimes the pause command is skipped. "Press any key to continue . . ." is printed, but execution of the batch file is immediately continued, which in this case means it ends because EOL is reached.

This gif shows the behavior. Notice how the first run of the batch pauses until the up arrow key is pressed, but on the second run the pause is skipped and the batch file terminates as soon as y is pressed to answer the choice:
![SkipPause](https://user-images.githubusercontent.com/31589520/116212464-23cab000-a745-11eb-8b26-31667652dbda.gif)

Contributor guide

Open the contributing guide

Research direction

Start by running the supplied batch file repeatedly in Windows Terminal and observe whether the choice response leaves input for pause. Done means that after answering choice, pause consistently waits for another key instead of being skipped.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, shell
Domain
cli, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.