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

Re: git does not wait on hook exes (^C)

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Feb 21, 2020, 02:25 UTC
Message-ID
<20200221022558.GD6462@camp.crustytoothpaste.net>
In-Reply-To
<CA+dzEBk5D9x=sQnKDwAPHXOS_8gnA37X9sn+ccpfViEauiC5ww@mail.gmail.com>
On 2020-02-21 at 01:20:51, Anthony Sottile wrote:
Show 7 quoted lines
> My hook in question is a python process: https://pre-commit.com
> 
> It doesn't really do all that much on SIGINT but prints "(^C)
> Interrupted" and offers a crash log when receiving ^C -- this races
> with the git process terminating and causes terminal spew (sometimes
> with pretty bad consequences with input breaking until `reset`
> depending on which thing wins the tty reset race).

Thanks, this is helpful context. I don't know that Git waiting for the process is going to fix the broken terminal state, although it will likely fix the jumbled output.

I'm not planning on writing a patch, but I think an interesting patch to see might be if we called wait(2) in a loop in a SIGINT handler but didn't reinstall the signal handler, which means that a second Ctrl-C would kill Git. I believe that's what certain other programs do, and that might address many of the problems in both scenarios.

-- 
brian m. carlson: Houston, Texas, US
OpenPGP: https://keybase.io/bk2204
Previous: Anthony SottileNext: Jeff King
Message 6 of 8 in “git does not wait on hook exes (^C)”
  1. Anthony SottileFeb 20, 2020
  2. brian m. carlsonFeb 21, 2020
  3. Anthony SottileFeb 21, 2020
  4. brian m. carlsonFeb 21, 2020
  5. Anthony SottileFeb 21, 2020
  6. brian m. carlsonFeb 21, 2020
  7. Jeff KingFeb 21, 2020
  8. Anthony SottileFeb 21, 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.