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

Re: Issue with git > 2.36.1 and pre-commit hook on macOS M1

From
PPiotrek <piotrekkr@o2.pl>
Date
Dec 17, 2022, 07:50 UTC
Message-ID
<a1fb9d92-5161-5ba0-54f2-a03cbc45f399@o2.pl>
In-Reply-To
<7054faf0-0f5b-e4a8-3166-bf715ed45a32@web.de>
On 14.12.2022 23:23, René Scharfe wrote:
Show 10 quoted lines
> I don't know "docker compose" well enough to say whether it's a bug,
> but it seems it turns on some kind of terminal mode that needs both
> stdin and stdout to be connected to a TTY after only checking that one
> of them actually is.  Why not check both?
> 
> Curious that only macOS should be affected.  Is stdin of a hook script a
> TTY on that platform?  Or can "docker compose" handle stdin not being a
> TTY and stdout being one there?
> 
> René

Well, seems like I somehow tested this wrong. Tried it again from scratch and on linux I also get this error. So this looks like not a bug. Docker compose CLI options page is a little confusing because of these:

 >--interactive , -i  true  Keep STDIN open even if not attached.
 >--no-TTY , -T 	     true  Disable pseudo-TTY allocation (default: 
auto-detected).
 >--tty , -t          true  Allocate a pseudo-TTY.

Second column with `true` values is titled `Default`, whatever it means. So `--tty` and `--no-TTY` is set by default? Anyway, seems like it is checking if at least one of stdout, stding, stderr is a tty and then tries to allocate a tty to all.

You can check docs here https://docs.docker.com/engine/reference/commandline/compose_run/#options

As a final solution I used makefile "magic" with `ifeq` and shell command like this:

     $(shell test -t 0)
     ifeq ($(.SHELLSTATUS), 1)
     ALLOCATE_TTY = --no-TTY
     endif
     docker compose run $(ALLOCATE_TTY) --rm --entrypoint "" app 
/code/test.sh

Maybe I'll just write to to them to clarify documentation on how those TTY options actually works by default.

Thanks for help with this. Piotr

Previous: René ScharfeNext: René Scharfe
Message 5 of 6 in “Issue with git > 2.36.1 and pre-commit hook on macOS M1”
  1. PiotrekDec 11, 2022
  2. René ScharfeDec 12, 2022
  3. PiotrekDec 13, 2022
  4. René ScharfeDec 14, 2022
  5. PiotrekDec 17, 2022
  6. René ScharfeDec 17, 2022

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.