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

Applications requiring user input hang #540

Closed
jdforsythe opened this issue Apr 11, 2016 · 11 comments

Comments

Projects
None yet
5 participants
@jdforsythe
Copy link

commented Apr 11, 2016

I'm using v2.0.3 packaged with Git for Windows.

Anything I try to run in the console that requires user input does not accept the user input.

For instance, try to clone a git repo over ssh - it asks to trust the host - you're to hit "y" and enter. It accepts the Y and when you press enter it moves down a line, but doesn't pass the "y" to the program.

/e/dev/
$ git clone git@server:repo.git
Cloning into 'repo'...
The server's host key is not cached in the registry. You
have no guarantee that the server is the computer you
think it is.
The server's rsa2 key fingerprint is:
ssh-rsa 2048 <key>
If you trust this host, enter "y" to add the key to
PuTTY's cache and carry on connecting.
If you want to carry on connecting just once, without
adding the key to the cache, enter "n".
If you do not trust this host, press Return to abandon the
connection.
Store key in cache? (y/n) y

Press ^C

/e/dev/
$ y
bash: y: command not found

The same happens with many applications (all?) requiring user input, like npm init - it walks you through all the questions perfectly fine, but once it gets to Ist this ok? (yes) it no longer responds to the enter key.

@jdforsythe

This comment has been minimized.

Copy link
Author

commented Apr 11, 2016

npm init:

/e/dev/test
$ npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.

See `npm help json` for definitive documentation on these fields
and exactly what they do.

Use `npm install <pkg> --save` afterwards to install a package and
save it as a dependency in the package.json file.

Press ^C at any time to quit.
name: (test)
version: (1.0.0)
description:
entry point: (index.js)
test command:
git repository:
keywords:
author:
license: (ISC)
About to write to E:\dev\test\package.json:

{
  "name": "test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}


Is this ok? (yes) yes

All the enter presses along the way work fine, but the last prompt fails

@mintty

This comment has been minimized.

Copy link
Owner

commented Apr 11, 2016

This sounds like the old pty problem (see e.g. #481), assuming you are using applications that are compiled for the Windows console rather than for MinGW MSYS (which Git is based on).
In the first example, it could be an openssl tool which is not the Git one but a Windows native version. While it's waiting at the prompt (for the "y"), try to find out which processes are running (ps in another window). Then find out where it's getting that from (e.g. type openssl).
About the second example, npm isn't part of the Git standard installation. What does type npm say?
Analysis will reveal this is not a mintty issue.

@jdforsythe

This comment has been minimized.

Copy link
Author

commented Apr 11, 2016

While it's hung at the openssh prompt:

$ ps
      PID    PPID    PGID     WINPID   TTY         UID    STIME COMMAND
    29836   19632   29836      10416  pty0     1049686   Apr  8 /usr/bin/bash
    18520   29836   18520      28948  pty0     1049686 09:12:28 /mingw64/bin/git
    24264   11940   24264      11328  pty1     1049686 09:12:36 /usr/bin/bash
    19632       1   19632      19632  ?        1049686   Apr  8 /usr/bin/mintty
    10540   24264   10540      14148  pty1     1049686 09:12:38 /usr/bin/ps
    11940       1   11940      11940  ?        1049686 09:12:36 /usr/bin/mintty

putty.exe and plink.exer are running the in Windows Task Manager.

$ type openssl
openssl is /mingw64/bin/openssl
$ type npm
npm is /c/Program Files/nodejs/npm

While it is true that both of these are compiled for Windows, there was no issue running these with the old version of git/git bash/mintty. Neither of those applications were updated, just the git install, so something changed between 1.x and 2.x that made these no longer work.

In any case, is there a workaround? This is my highly-preferred terminal but I can't use a lot of things in it now.

@mintty

This comment has been minimized.

Copy link
Owner

commented Apr 11, 2016

I can hardly believe that the change from mintty 1.x to 2.x alone may have caused this issue. What else has changed? You might try to recompile mintty 1.2 from source (to recompile an older version, remove "-Werror" from the Makefile; or I might provide a binary) for a test. Or restore an environment that works for you and then update mintty only (e.g. by compiling it explicitly, or saving the current version and running it then). But likely this should be reported to the Git issue tracker.

@mintty

This comment has been minimized.

Copy link
Owner

commented Apr 14, 2016

Closing, see previous comment.

@mintty mintty closed this Apr 14, 2016

@jboyd01

This comment has been minimized.

Copy link

commented Aug 4, 2016

@jdforsythe did you resolve your issue? I'm experiencing the same thing.

@jdforsythe

This comment has been minimized.

Copy link
Author

commented Aug 5, 2016

The problem is not solved. Using a newer version of git bash [and presumably mintty] has solved some other issues but this is worse. Now npm init doesn't even ask the questions anymore.

@mintty

This comment has been minimized.

Copy link
Owner

commented Aug 5, 2016

The problem is not solved but it is not a mintty problem. See my comments above.

@Bram-Zijp

This comment has been minimized.

Copy link

commented Aug 15, 2016

Also have this issue with Git Bash. Just hangs on Is this ok? (yes) on npm init.

@mintty

This comment has been minimized.

Copy link
Owner

commented Aug 16, 2016

See #540 (comment) above.

@i-give-up

This comment has been minimized.

Copy link

commented Sep 1, 2017

For anyone still having issues, I found these under "Known Issues" in Git for Windows Release Notes

  • If configured to use Plink, you will have to connect with putty first and accept the host key.
  • Some console programs, most notably non-MSYS2 Python, PHP, Node and OpenSSL, interact correctly with MinTTY only when called through winpty (e.g. the Python console needs to be started as winpty python instead of just python).

From what I understand, what is happening is that git bash uses the msys2 platform. When a program that is not compiled for the msys2 platform (e.g. plink) is executed within msys2, it might have some issues with user input and output.

Hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.