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

Generator seems to hang waiting for user to hit Enter to finish #10

Closed
jasonjoh opened this issue Aug 27, 2015 · 13 comments
Closed

Generator seems to hang waiting for user to hit Enter to finish #10

jasonjoh opened this issue Aug 27, 2015 · 13 comments

Comments

@jasonjoh
Copy link
Contributor

Using generator on Windows 10 in the following manner:

yo office
? Project name (display name): yotest2
? Root folder of project? Default to current directory
 (C:\Users\jasonjoh\Source\Repos\mail-addins\yotest2), or specify relative path
  from current (src / public):
? Office project type: Mail Add-in (read & compose forms)
? Technology to use: HTML, CSS & JavaScript

After the generator does its work, and the final line is output:

microsoft.office.js#2b215a298b bower_components\microsoft.office.js

The generator seems to hang, with the cursor just flashing. If you press Enter, it will exit.

Ideally the need to hit Enter can be removed, but if it can't, the tool should tell the user they need to hit Enter to exit.

@martellaj
Copy link
Contributor

+1 confirmed.

@andrewconnell
Copy link
Contributor

Confirmed... investigated but not sure what's causing it. Still under investigation...

@waldekmastykarz
Copy link
Contributor

For what it's worth: I've found that when you run yo office the generator waits at the end to press Enter as you guys mentioned, but if you call it with a specific add-in type, ie yo office:taskpane it finishes just as expected.

@waldekmastykarz
Copy link
Contributor

Digging a bit further I found out that it's the clients question that's causing the stop. If you pass it as one of the options, ie. yo office --clients Word the generator finishes as expected without the need to press Enter at the end.

@andrewconnell
Copy link
Contributor

I wish that was the case... it was doing this before we added the question about which client(s) you wanted.

Need to look into it more. I actually see this with multiple command line tools based on Node... not just Yeoman.

@jasonjoh
Copy link
Contributor Author

jasonjoh commented Oct 9, 2015

It seems to be related to the interactions of prompts between the main generator and the subgenerator. I was playing with extending the mail subgenerator and added another prompt in the sub (./mail/index.js). The stop disappeared. However my prompt was a checkbox prompt, and I couldn't interact with it. I moved it to the main generator (./app.index.js) and I could then interact with it. But the stop reappeared!

So, not an answer, but maybe a clue.

@jasonjoh
Copy link
Contributor Author

jasonjoh commented Oct 9, 2015

Ok, more info: If you remove the askFor function altogether from ./mail/index.js, the stop disappears. (You have to add the line this.genConfig = extend(this.genConfig, this.options); to the constructor though if you do this!) My guess is that because the prompts in that function are redundant with the prompts in the askFor in ./app/index.js, we're basically calling this.prompt with all disabled prompts (from the when clause), and maybe it requires you to hit enter?

So the question is why do we have another askFor in ./mail/index.js that repeats the same prompts from ./app/index.js? Is there a way to call the mail one directly without going through app?

@jthake
Copy link
Contributor

jthake commented Oct 10, 2015

Gonna sit with @andrewconnell and work through this one...

@andrewconnell
Copy link
Contributor

@jasonjoh The reason we dupe the askFor question is if someone runs the subgenerator directly. You can call the default subgenerator app which simply acts as a router of sorts by using $ yo office. Based on what you question answers are in the prompts, it calls another subgenerator. For instance all these are valid:

$ yo office:mail
$ yo office:content
$ yo office:taskpane

So you can't just remove the askFor from the subgenerators... it will break running a subgenerator because there will be no prompts.

@jasonjoh
Copy link
Contributor Author

Ah ok, I figured it must be something like that. Well that blows my easy fix :)

@jasonjoh
Copy link
Contributor Author

jasonjoh commented Dec 3, 2015

So a couple of updates on this one.

First: you don't need to duplicate the prompts. You can just keep the prompt in the subgenerator and let it do the prompting. The app generator should only ask questions that apply across all of the subgenerators.

Second: the hang may be related to SBoudrias/Inquirer.js#266, which in itself is apparently a bug in Node.js on Windows. This explains the behavior I reported above with the new prompt (couldn't interact with a checkbox prompt). There's a state that Inquirer can get into where it pauses waiting for an Enter. @andrewconnell, have you seen this on any non-Windows machines?

@andrewconnell
Copy link
Contributor

RE #1 – can you still call the generator with arguments to bypass the questions? Will they still get picked up by the sub generators? That’s the primary reason we added them to the app “top-level” generator

RE #2 – interesting… but I don’t think it’s Windows related. I see it from time to time on OS X and that’s the only place I use the generator

@jasonjoh
Copy link
Contributor Author

jasonjoh commented Dec 4, 2015

On #1, yes, you leave it as an option in the top-level generator, just remove the prompt.

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

5 participants