mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-11-12 15:53:33 -04:00
Ignore SIGHUP in the index.lock test hook before forking
sync/lock_error_partway_through_pull_with_rebase failed on CI: every attempt to continue the rebase ran into index.lock, as if the lock was never released. The test hook that holds index.lock starts a background process that removes the lock once the git command that ran the hook has exited. If lazygit runs the command in a pty, as it does for a pull, the command's exit sends SIGHUP to that process. The process ignored SIGHUP, but only once it got to run. On a busy machine the command can exit before that; SIGHUP then kills the process and leaves the lock behind. Delaying the start of the process by 0.3s makes the test fail every time. Ignore SIGHUP in the hook before starting the background process, so that the process inherits it. With this, the test passes even with the delay. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
0cfc475000
commit
3f73e56fd3
@@ -11,10 +11,12 @@ import (
|
||||
// of several steps, such as a rebase, is partway through.
|
||||
const holdIndexLockScript = `if [ ! -e .git/index-lock-taken ]; then
|
||||
touch .git/index-lock-taken .git/index.lock
|
||||
# If lazygit runs the command in a pty (as it does for a pull), the
|
||||
# background process below gets SIGHUP when the command exits. This can
|
||||
# happen before the process has run its first command, so ignore SIGHUP
|
||||
# before starting it; it inherits this.
|
||||
trap '' HUP
|
||||
(
|
||||
# If lazygit runs the command in a pty (as it does for a pull), we
|
||||
# get SIGHUP when the command exits
|
||||
trap '' HUP
|
||||
while kill -0 $PPID 2>/dev/null; do sleep 0.01; done
|
||||
rm -f .git/index.lock
|
||||
) >/dev/null 2>&1 </dev/null &
|
||||
|
||||
Reference in New Issue
Block a user