Re: [PATCH 1/1] t6500(mingw): use the Windows PID of the shell
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- May 7, 2019, 22:25 UTC
- Message-ID
- <CAPig+cQG4+A+G+i+8RqpDAY2PveULVJ5iNR4HYEUPAd_4Ub04w@mail.gmail.com>
- In-Reply-To
- <ba78a47b873c5f044cbfb147b30a801cc90fb0ac.1557265888.git.gitgitgadget@gmail.com>
On Tue, May 7, 2019 at 5:51 PM Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com> wrote:
Show 17 quoted lines
> [...] > Let's fix this by making sure that the Windows PID is written into > `gc.pid` in this test script soo that `git.exe` is able to understand > that that process does indeed still exist. > > Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> > --- > @@ -162,7 +162,15 @@ test_expect_success 'background auto gc respects lock for all operations' ' > + shell_pid=$$ && > + if test_have_prereq MINGW && test -f /proc/$shell_pid/winpid > + then > + # In Git for Windows, Bash (actually, the MSYS2 runtime) has a > + # different idea of PIDs than git.exe (actually Windows). Use > + # the Windows PID in this case. > + shell_pid=$(cat /proc/$shell_pid/winpid) > + fi && > + printf "%d %s" "$shell_pid" "$hostname" >.git/gc.pid &&
I wonder if it would make sense to abstract this away behind a shell function named shell_pid() which can be specialized for MINGW, much like the shell function pwd() is specialized on Windows.