Closed vsemozhetbyt closed 6 years ago
@vsemozhetbyt the color is probably because of git bash.
Definitely duplication colors of metadata is a bug which should probably be related to git bash too.
@vsemozhetbyt can you let me know what does this cmd
node -p -e "Boolean(process.stdout.isTTY)"
prints out in Git Bash.
@cPhost
$ node -p -e "Boolean(process.stdout.isTTY)"
true
Basically the only way the metadata could be outputted to terminal two time is if
if(!process.stdout.isTTY)
which in this case we confirmed should not and the other time with
lib/cli
module. which works as expected as git bash is a terminal.
@cPhost I suppose this may be connected with this note here:
Note: On Windows, running Node.js in windows terminal emulators like
mintty
requires the usage of winpty for Node's tty channels to work correctly (e.g.winpty node.exe script.js
). In "Git bash" if you call the node shell alias (node
without the.exe
extension),winpty
is used automatically.
With node.exe
:
$ node.exe -p -e "Boolean(process.stdout.isTTY)"
false
Does redirecting work with Git bash? We can probably somehow check that in the code an don't write to stdout if that's the case...
Or is it a bug of node core? Shouldn't it be false
?
FWIW, with winpty
and the full filename both nits are fixed:
$ winpty node.exe -p -e "Boolean(process.stdout.isTTY)"
true
There was a bug reported in core for this which was closed. The reason this happens is that Git Bash is using (maybe using?) pipes.
Finally we can add note to readme about this.
Windows 7 x64 Node.js 9.2.0 get-metadata 1.6.1
Please, compare the outputs in a
cmd.exe
:and Git Bash for Windows: