You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
process.stdin never returns with using Git Bash for Windows #5620
C:\Users\t-nagashima.AD\Documents\GitHub\WebDevolopment\Pizzeria-ES2015>cmd /C=node test.js
before stdin: parent TTY
after stdin: parent
before stdin: child TTY
after stdin: child
PowerShell OK
PS C:\Users\t-nagashima.AD\Documents\GitHub\WebDevolopment\Pizzeria-ES2015> cmd /C="node test.js"
before stdin: parent TTY
after stdin: parent
before stdin: child TTY
after stdin: child
Git Shell of GitHub for Windows OK
C:\Users\t-nagashima.AD\Documents\GitHub\WebDevolopment\Pizzeria-ES2015 [master +1 ~1 -0 !]> cmd /C="node test.js"
before stdin: parent TTY
after stdin: parent
before stdin: child TTY
after stdin: child
Git Bash of Git for Windows Wrong
t-nagashima@T-NAGASHIMA4 MINGW64 /c/Users/t-nagashima.AD/Documents/GitHub/WebDevolopment/Pizzeria-ES2015 (master)
$ cmd /C="node test.js"
before stdin: parent PIPE
after stdin: parent
before stdin: child PIPE
The program stops at process.stdin, then "after stdin: child" has never printed.
If I types Enter Key, the program resumes.
@seishun I'm not sure what happens in that case TBH. Git Bash is a MSYS based environment AFAIK, so I wonder if it will load that super-old CRT MSYS was based on.
In Git Bash, with node.exe test.js I get the issue described here (PIPE), but with node test.js it works fine (TTY). However, winpty works well either way:
In Git Bash, with node.exe test.js I get the issue described here (PIPE), but with node test.js it works fine (TTY).
In case anyone is wondering, this is because Git Bash aliases node to winpty node.exe. According to @dscho, they have to read fewer bug reports this way (see git-for-windows/git#738 (comment)).
Hah, and instead we get to deal with the fallout? Nice!
Sorry for that.
Am I right in concluding that this is an environmental issue not directly caused by or under control of node?
Yes, the problem is caused by MinTTY using the tty emulation of MSYS2's runtime (which is a portable version of the Cygwin runtime), and node expecting to talk to a real Win32 Console (which the winpty bridge provides and synchronizes to the MSYS2 tty).
Hey guys, I'm not as technical as you, but I followed all the links here and in other issues and have read it all (didn't understand much, since my programming skill-set is only client-side), and I didn't fully get what is the status of the git bash colors issue?
should I download any new version of anything? because I'm already on latest GIT (windows port) so should I try Node7? I'm not sure what to do to see colors on my Git Bash :(
@gibfahn - thank you, I followed the maze of issues pointing to one another until I ended up here, at the bottom of the trail, so I thought it wouldn't hurt asking, but luckily I was helped in another thread
In opposition to workaround given by @gibfahn above I had to use node.exe instead of node to get some script processing content redirected on stdin, so my workaround is the opposite to his suggestion.
Activity
evanlucas commentedon Mar 9, 2016
/cc @nodejs/platform-windows
rvagg commentedon Mar 9, 2016
smells like it might be related to #5384
mysticatea commentedon May 19, 2016
#5384 (comment) seems to be fixed on v6.2.0.
But this is still an issue.
seishun commentedon Oct 13, 2016
Simpler testcase:
node.exe test.jsin Git Bash.This happens because the call to
pNtQueryInformationFilehangs here.Might be a Windows bug?
Pinging @orangemocha @piscisaureus @saghul
saghul commentedon Oct 13, 2016
@seishun I'm not sure what happens in that case TBH. Git Bash is a MSYS based environment AFAIK, so I wonder if it will load that super-old CRT MSYS was based on.
seishun commentedon Oct 13, 2016
@saghul Do you mean C runtime library? That's irrelevant since NtQueryInformationFile is a Win32 function, right?
Also Git Bash is based on MSYS2 nowadays, which is a recent fork of Cygwin.
saghul commentedon Oct 13, 2016
Yes, it's a Win32 API function, but stdin / out / err are CRT fds, so I guess the problem comes somewhere around there.
joaocgreis commentedon Oct 15, 2016
This is related to #3006 .
In Git Bash, with
node.exe test.jsI get the issue described here (PIPE), but withnode test.jsit works fine (TTY). However,winptyworks well either way:seishun commentedon Oct 15, 2016
In case anyone is wondering, this is because Git Bash aliases
nodetowinpty node.exe. According to @dscho, they have to read fewer bug reports this way (see git-for-windows/git#738 (comment)).bnoordhuis commentedon Oct 17, 2016
Hah, and instead we get to deal with the fallout? Nice!
Am I right in concluding that this is an environmental issue not directly caused by or under control of node? If yes, I move to close.
dscho commentedon Oct 17, 2016
Sorry for that.
Yes, the problem is caused by MinTTY using the tty emulation of MSYS2's runtime (which is a portable version of the Cygwin runtime), and node expecting to talk to a real Win32 Console (which the
winptybridge provides and synchronizes to the MSYS2 tty).FWIW I agree.
bnoordhuis commentedon Oct 18, 2016
Thanks for chiming in. Okay, I'll go ahead and close.
yairEO commentedon Nov 1, 2016
Hey guys, I'm not as technical as you, but I followed all the links here and in other issues and have read it all (didn't understand much, since my programming skill-set is only client-side), and I didn't fully get what is the status of the git bash colors issue?
should I download any new version of anything? because I'm already on latest GIT (windows port) so should I try Node7? I'm not sure what to do to see colors on my Git Bash :(
gibfahn commentedon Nov 1, 2016
@yairEO I don't think this issue was related to colours on Git bash. What exactly is the issue you're seeing?
This issue is a problem with Git Bash not with node, the workaround is to run
node your_file.jsinstead ofnode.exe your_file.js.yairEO commentedon Nov 1, 2016
@gibfahn - thank you, I followed the maze of issues pointing to one another until I ended up here, at the bottom of the trail, so I thought it wouldn't hurt asking, but luckily I was helped in another thread
benjamingr commentedon Nov 2, 2016
@yairEO in the future you're very welcome to ask questions at https://github.com/nodejs/help
ltvan commentedon Nov 25, 2016
I think that this should help:
alias -p npm="winpty npm.exe"Run it in git-bash once and you can use 'npm test'
ltvan commentedon Nov 25, 2016
Actually you should run this instead and restart git-bash:
echo alias -p npm=\"winpty npm.exe\" >> ~/.bashrcdscho commentedon Nov 25, 2016
@ltvan does this really fix the problem with the script described in this ticket?
If so, would it not make more sense to add
npmhandling to https://github.com/git-for-windows/build-extra/blob/db6871f1f5490670456f2869387c7e9fcb6b5d9c/git-extra/aliases.sh#L13 ?ltvan commentedon Nov 25, 2016
It does work in my environment. Adding to git-extra is good so.
However, if you run through gulp or grunt, the
winpty gulpwon't work.soletan commentedon Mar 30, 2020
In opposition to workaround given by @gibfahn above I had to use node.exe instead of node to get some script processing content redirected on stdin, so my workaround is the opposite to his suggestion.
didn't work:
did work:
fix(test): skip SIGINT E2E on Windows GH runners; track as #57