Skip to content
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

Fix issue when user pressed escape #10

Closed
SamVerschueren opened this issue Nov 15, 2015 · 10 comments
Closed

Fix issue when user pressed escape #10

SamVerschueren opened this issue Nov 15, 2015 · 10 comments

Comments

@SamVerschueren
Copy link
Owner

The plugin does not execute a new generator if the user pressed escape in the previous flow.

When the user starts a new generation and presses esc at some question, the flow is stopped. When he triggers a new generator, the environment is executed correctly on line 67, but the prompt method is not fired.

Does this have something to do with not calling the callback here?

@SamVerschueren
Copy link
Owner Author

@sindresorhus any idea?

@sindresorhus
Copy link

Might be related to lots of flakiness with readline in recent Node.js versions. See: sindresorhus/fkill-cli#4 (comment).

@SamVerschueren
Copy link
Owner Author

It's a GUI interface (Visual Studio Code), so probably not related. Probably something regarding not correctly exiting a generator.

@sindresorhus
Copy link

Oh, I thought I was on a different repo...

Maybe @SBoudrias would know.

@SBoudrias
Copy link

@SamVerschueren does it work if you just run two generators one after the other?

Might be an issue with grouped-queue being stopped or jammed waiting for an async callback.

@SamVerschueren
Copy link
Owner Author

@SBoudrias this does not work either, can only run one generator. Is this something I can fix in my code or should it be done somewhere else?

@SamVerschueren
Copy link
Owner Author

Sorry to ping you back @SBoudrias, but want this to be resolved before the public release of VS Code Extensions.

So this is not happening because the callback is not called with an answer object here: adapter.ts#L43-L53?

Something I might find interesting, is that the on('end') of the environment is not called when quiting the generator early, which happens here: yo.ts#L75.

PS. I will understand if you don't have the time right now to look into this :).

@SBoudrias
Copy link

@SamVerschueren yeah, I don't know how you're quitting early, but this is clearly a problem with the state not being reset clean.

Maybe you should explore alternative strategy? Like running yeoman in sub process where quitting early means killing the whole process.

@david-driscoll
Copy link

I would recreate the Yeoman instance, I had a similar problem with atom. Basically the yeoman environment needs to be reset. https://github.com/SamVerschueren/vscode-yo/blob/master/src/extension.ts#L9

@SamVerschueren
Copy link
Owner Author

Everyone, thanks for the input, got it working by recreating Yeoman as @david-driscoll suggested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants