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

Schematics does not prompt for input from user in git bash. #18163

Open
darpankumar opened this issue Jul 6, 2020 · 9 comments
Open

Schematics does not prompt for input from user in git bash. #18163

darpankumar opened this issue Jul 6, 2020 · 9 comments

Comments

@darpankumar
Copy link

@darpankumar darpankumar commented Jul 6, 2020

🐞 Bug report

Command (mark with an x)

  • [x ] new
  • build
  • serve
  • test
  • e2e
  • generate
  • add for custom Schematics
  • update
  • lint
  • xi18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

No

No Yes, the previous version in which this bug was not present was: ....

Description

Either it is custom Schematics or angular Schematics, when I try to run this in git bash it does not prompt for values and runs the whole workflow with default values and if no default value is set it either fail if require flag is true otherwise set the empty value for the input.
even though somebody previously raised this issue
#14938
But it was marked closed
I see this as a bug because it behaves differently in a different terminal. the behaviour should be the same across all the terminal. otherwise, some information must be given BCS of which it is happening.

One observation if you create schematics and test it locally by
npm link path to schematics
and then try to run the schematics with command
schematics path:schematic-name
then it works in git bash as well.

A clear and concise description of the problem...

🔬 Minimal Reproduction

ng new appName
It works fine in command prompt
on mac terminal
vs code terminal
but with git bash it causes problem it do not ask for user input and run the whole workflow with default values

🔥 Exception or Error





🌍 Your Environment




Angular CLI: 9.0.6
Node: 12.16.1
OS: win32 x64
Angular:
...
Ivy Workspace:
Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.900.6
@angular-devkit/core         9.0.6
@angular-devkit/schematics   9.0.6
@schematics/angular          9.0.6
@schematics/update           0.900.6
rxjs                         6.5.3

Anything else relevant?

@alan-agius4
Copy link
Collaborator

@alan-agius4 alan-agius4 commented Jul 6, 2020

Git Bash is a non-interactive terminal which means our prompt library doesn't work with it.

See: SBoudrias/Inquirer.js#570

@darpankumar
Copy link
Author

@darpankumar darpankumar commented Jul 6, 2020

Why does it work when i run it with schematics path:schematic-name @alan-agius4

@alan-agius4
Copy link
Collaborator

@alan-agius4 alan-agius4 commented Jul 6, 2020

That is an interesting detail. Will need to investigate this a bit more.

@clydin
Copy link
Member

@clydin clydin commented Jul 6, 2020

What version of Windows is being used?

@darpankumar
Copy link
Author

@darpankumar darpankumar commented Jul 7, 2020

What version of Windows is being used?

Its window 7 enterprise

@darpankumar
Copy link
Author

@darpankumar darpankumar commented Jul 7, 2020

Screenshot 2020-07-06 at 11 14 20 PM

@alan-agius4 you can have a look at the screenshot attached
@alan-agius4
Copy link
Collaborator

@alan-agius4 alan-agius4 commented Jul 7, 2020

In the Schematics CLI, the prompts are being displayed because unlike in the Angular CLI we are not checking whether the terminal is TTY.

Schematics CLI

// Add prompts.
workflow.registry.usePromptProvider(_createPromptProvider());

NG CLI

if (options.interactive !== false && isTTY()) {
workflow.registry.usePromptProvider((definitions: Array<schema.PromptDefinition>) => {
.

Can you try to run node --eval "console.log({stdin: process.stdin.isTTY, stdout: process.stdout.isTTY})"?

@darpankumar
Copy link
Author

@darpankumar darpankumar commented Jul 7, 2020

Screenshot 2020-07-07 at 5 07 39 PM

Here is the output @alan-agius4
@alan-agius4
Copy link
Collaborator

@alan-agius4 alan-agius4 commented Jul 8, 2020

Hi @darpankumar, myself and @clydin had a chat around the issue that you are experiencing and unfortunately this is not something that we can easily replicate as this would require some debugging on your system.

I am going to leave the issue open for a couple of days maybe someone else can replicate this debug and be able to find the root cause of the problem.

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

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.