git/list[1] front-page[2] threads[3] people[4] search[5] about
 

git for windows: isatty of stdin / stdout inconsistent

From
Anthony Sottile <asottile@umich.edu>
Date
Jun 12, 2020, 17:06 UTC
Message-ID
<CA+dzEB=OiqaEW0CEQoChStZYcho68J9ysH_XYp0Qupbrgg1Jxg@mail.gmail.com>
this seems inconsistent with posix platforms

(using cmd.exe, git 2.19.1.windows.1 though I've validated this with other versions as well)

>cat .git\hooks\pre-commit

#!/usr/bin/env python # note: use python3 on linux platforms for shebang import sys print(f'stdin: {sys.stdin.isatty()}') print(f'stdout: {sys.stdout.isatty()}') print(f'stderr: {sys.stderr.isatty()}')

>git commit -m foo --allow-empty

stdin: True stdout: False stderr: True [master (root-commit) 9c7716f] foo

but on linux:

$ git --version git version 2.25.1 $ git commit -m foo --allow-empty stdin: False stdout: True stderr: True [master (root-commit) eb8435a] foo

it's also weird to me that `stdin` seems flipped between the two as well
actual issue: this is breaking coloring detection in https://pre-commit.com
Anthony
Message 1 of 1 in “git for windows: isatty of stdin / stdout inconsistent”
  1. Anthony SottileJun 12, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.