-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support asynchronous question.default
#114
Conversation
@@ -89,4 +97,4 @@ PromptUI.prototype.onEachPrompt = function( question, done ) { | |||
done( null ); | |||
} | |||
}, this.answers ); | |||
}; | |||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need new line at end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait a minute
@danielchatfield Wait a minute plz. |
It's already 5:30am at my time. Gotta sleep. Dying. |
No problem, this will need some thought before merging anyway. "leave the memleak warning of node.js which was already existing" <- how are you getting this warning, last time we had this it was an actual memory leak: #63 |
The warning details (node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
at ReadStream.EventEmitter.addListener (events.js:179:15)
at ReadStream.Readable.on (_stream_readable.js:667:33)
at new Interface (readline.js:124:11)
at Object.exports.createInterface (readline.js:38:10)
at Object.Interface.createInterface (/Users/Kael/Codes/Node/Inquirer.js/node_modules/readline2/index.js:39:21)
at PromptUI.UI (/Users/Kael/Codes/Node/Inquirer.js/lib/ui/baseUI.js:23:40)
at new PromptUI (/Users/Kael/Codes/Node/Inquirer.js/lib/ui/prompt.js:26:8)
at Object.inquirer.prompt (/Users/Kael/Codes/Node/Inquirer.js/lib/inquirer.js:39:10)
at Context.<anonymous> (/Users/Kael/Codes/Node/Inquirer.js/test/specs/inquirer.js:246:25) |
So is it something wrong that we forget to remove the listeners after the execution of See you tomorrow. |
I need to go to bed as well. What are you actually running to produce that trace? I can't get it to give me that warning. |
Maybe we should open another issue to talk about this? 'coz the current version of Inquirer.js already has this issue (Rel #115) |
Hey, sorry for the time it took to get a review here. I don't really like how the logic is handled here. Having two methods IMO, the flow would be cleaner if the question was passed in a factory method that would handle the async complexity of setting up correctly every values of the questions before hand. Do you can think you could handle this task? |
Sorry, i was deadly busy these days. I'll check this today. Did you mean i should handle the question.default inside the centralized sys, i.e. prompt/base? |
The problems I met:
Let's take Then the second is "what is your username ?". We will notice that the default answer of So, we can't handle the default value before hand, and it is impossible to do as a instance method of the The conclusion is: We must handle |
@kaelzhang Thanks for holding up, I think it is good enough then. I'll merge. |
Support asynchronous `question.default`
@SBoudrias Thanks 😄 . I'll handle #125 then. |
process.stdin.setMaxListeners(20)
?