You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for the bug report and the code example. I can reproduce it with your snippet easily.
This is a weird behaviour because at the time we press "enter", the readline isn't set, and there's no keypress listener. So it's like there's some kind of replay of the events.
constprompt: Prompt<Value,Config>=(config,context)=>{// Default `input` to stdinconstinput=context?.input??process.stdin;// Add mute capabilities to the outputconstoutput=newMuteStream();output.pipe(context?.output??process.stdout);constrl=readline.createInterface({terminal: true,
input,
output,})asInquirerReadline;constscreen=newScreenManager(rl);
Even though rl is set here, the ReadableStream (process.stdin) already has data from user in the stream when an enter key is pressed.
After the 2 seconds wait, the readline would register keypress event automatically for the input ("This is automatically called by any readline instance on its input if the input is a terminal." from Node's doc) and the data hasn't been read in input would emit the keypress events.
Haven't thought of a good solution to the problem for now, but I would like to share what I found.
when i accidentally hit enter before propts appeared, propts will receive this enter,How to fix this situation?
The text was updated successfully, but these errors were encountered: