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

node stdout is not a tty #2651

Closed
1 task done
albertosantini opened this issue Jun 2, 2020 · 6 comments
Closed
1 task done

node stdout is not a tty #2651

albertosantini opened this issue Jun 2, 2020 · 6 comments

Comments

@albertosantini
Copy link

  • I was not able to find an open or closed issue matching what I'm seeing

Setup

  • Which version of Git for Windows are you using? Is it 32-bit or 64-bit?

PortableGit-2.27.0-64-bit.7z.exe

$ git --version --build-options

git version 2.27.0.windows.1
cpu: x86_64
built from commit: 907ab1011dce9112700498e034b974ba60f8b407
sizeof-long: 4
sizeof-size_t: 8
  • Which version of Windows are you running? Vista, 7, 8, 10? Is it 32-bit or 64-bit?

Windows 10 1909

$ cmd.exe /c ver

Microsoft Windows [Version 10.0.18363.836]
(c) 2019 Microsoft Corporation. All rights reserved.
  • What options did you set as part of the installation? Or did you choose the
    defaults?
Portable installation

Details

  • Which terminal/shell are you running Git from?

C:\git\bin\bash.exe --login -i from command prompt

$ node -v | cut -c2-8
stdout is not a tty
  • What did you expect to occur after running these commands?
$ node -v | cut -c2-8
12.17.0
  • What actually happened instead?

stdout is not a tty is displayed

I read from Git for Windows v2.27.0 Release Notes (https://github.com/git-for-windows/build-extra/blob/master/ReleaseNotes.md#known-issues):

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).

And from Git for Windows 2.27.0 release:

This release comes with a Git Bash that optionally uses Windows-native pseudo consoles. 
Meaning: finally, Git Bash can accommodate console programs like node.exe, Python or PHP, 
without using the winpty helper (see Known Issues). Note that this is still a very new feature 
and is therefore known to have some corner-case bugs.

But winpty is added in etc/profile.d/aliases.sh creating alias node='winpty node.exe'.

$ node -v | cut -c2-8
stdout is not a tty
$ unalias node
$ node -v | cut -c2-8
12.17.0

As quick workaround I added unalias node in my .profile file, but I was wondering if we need to remove those aliases in aliases.sh?

@rimrul
Copy link
Member

rimrul commented Jun 2, 2020

That option is still experimental, disabled by default, disabled in portable and requires Windows 10 with the spring 2018 update (1803) so we can't just drop those aliases yet and probably can't drop them for the next couple of years.

What we could do though, is introduce a wrapper script that checks for MSYS=enable_pcon (pseudo console support available) and if [ -t 1] (stdout is not a tty, the issue you encountered) before then calling those commands with/without winpty accordingly.

@dscho
Copy link
Member

dscho commented Jun 2, 2020

The quickest workaround is to call node.exe (with the .exe suffix). That will side-step the alias.

@albertosantini
Copy link
Author

I see. Thanks for the details.

@dscho
Copy link
Member

dscho commented Jun 2, 2020

@albertosantini I do hope that the pseudo console support stabilizes quickly. (But it might be a while; the first Cygwin version that had it came out last year, and they ran through 5 patch versions, the most recent came out yesterday.)

@jakub-g
Copy link

jakub-g commented Sep 16, 2020

Hi, I just came across this. Thanks for the explanations. As far as I can tell this happens with default settings after upgrading.

Do you not consider the discrepancy between node and node.exe as a bug?

(Just for info, it took me a while to understand the issue, and that node.exe behaves differently and that it comes from upgrading git. I guess many people could be affected by this behavior change.)

@dscho
Copy link
Member

dscho commented Sep 16, 2020

(Just for info, it took me a while to understand the issue, and that node.exe behaves differently and that it comes from upgrading git. I guess many people could be affected by this behavior change.)

To make sure, the difference in behavior stems from the POSIX emulation provided by the MSYS2 runtime, i.e. what Git Bash is made to believe is a Unix-style pseudo terminal. That changed, and that is what winpty (which is what that node alias uses to pretend to node.exe that we're running in a CMD window) is not handling gracefully.

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

No branches or pull requests

4 participants