Skip to content
This repository was archived by the owner on Feb 1, 2022. It is now read-only.

Commit b2215eb

Browse files
committed
fix(anykey): allow pressing "enter"
1 parent 9503aac commit b2215eb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/prompt.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export async function anykey(message?: string): Promise<void> {
5959
? `Press any key to continue or ${chalk.yellow('q')} to exit`
6060
: `Press enter to continue or ${chalk.yellow('q')} to exit`
6161
}
62-
const char = await prompt(message, {type: 'single'})
62+
const char = await prompt(message, {type: 'single', required: false})
6363
if (tty) process.stderr.write('\n')
6464
if (char === 'q') error('quit')
6565
if (char === '\u0003') error('ctrl-c')
@@ -94,7 +94,7 @@ function _prompt(name: string, inputOptions: Partial<IPromptOptions> = {}): Prom
9494
async function single(options: IPromptConfig): Promise<string> {
9595
const raw = process.stdin.isRaw
9696
if (process.stdin.setRawMode) process.stdin.setRawMode(true)
97-
const response = await normal(options)
97+
const response = await normal({required: false, ...options})
9898
if (process.stdin.setRawMode) process.stdin.setRawMode(!!raw)
9999
return response
100100
}

0 commit comments

Comments
 (0)