File tree Expand file tree Collapse file tree 1 file changed +3
-12
lines changed
Expand file tree Collapse file tree 1 file changed +3
-12
lines changed Original file line number Diff line number Diff line change 1- import * as readline from 'readline' ;
1+ import { createInterface } from 'readline/promises ' ;
22
33import chalk from 'chalk' ;
44
55export const userPrompt = async ( prompt : string ) : Promise < string > => {
6- const rl = readline . createInterface ( {
6+ const rl = createInterface ( {
77 input : process . stdin ,
88 output : process . stdout ,
9- terminal : true ,
109 } ) ;
1110
1211 try {
13- // Disable the readline interface's internal input processing
14- if ( rl . terminal ) {
15- process . stdin . setRawMode ( false ) ;
16- }
17- return await new Promise < string > ( ( resolve ) => {
18- rl . question ( chalk . green ( '\n' + prompt + '\n' ) + '\n> ' , ( answer ) => {
19- resolve ( answer ) ;
20- } ) ;
21- } ) ;
12+ return await rl . question ( chalk . green ( '\n' + prompt + '\n' ) + '\n> ' ) ;
2213 } finally {
2314 rl . close ( ) ;
2415 }
You can’t perform that action at this time.
0 commit comments