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

Commit

Permalink
fix: add newline after anykey
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Jun 15, 2018
1 parent 8ad6627 commit 13ccb4d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,14 @@ export function confirm(message: string): Promise<boolean> {
* "press anykey to continue"
*/
export async function anykey(message?: string): Promise<void> {
const tty = !!process.stdin.setRawMode
if (!message) {
message = process.stdin.setRawMode
message = tty
? `Press any key to continue or ${chalk.yellow('q')} to exit`
: `Press enter to continue or ${chalk.yellow('q')} to exit`
}
const char = await prompt(message, {type: 'single'})
if (tty) process.stderr.write('\n')
if (char === 'q') error('quit')
if (char === '\u0003') error('ctrl-c')
return char
Expand Down

0 comments on commit 13ccb4d

Please sign in to comment.