Sync Neovim's plugins once more if Neovim crashes
Neovim 0.12.6 segfaulted on the way out after a finished Lazy! sync (report CD-P8RUBS), and the update step failed though the plugins were up to date. If nvim dies from a signal, run the sync once more; it fails if Neovim crashes again, and an ordinary failure isn't retried. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -70,3 +70,32 @@ update_neovim() {
|
|||||||
[ -f "$LAZY/lazy.nvim/untracked.so" ]
|
[ -f "$LAZY/lazy.nvim/untracked.so" ]
|
||||||
[ ! -e "$BACKUPS" ]
|
[ ! -e "$BACKUPS" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "a sync that crashes Neovim is run once more" {
|
||||||
|
plugin lazy.nvim
|
||||||
|
# Crash the first time only
|
||||||
|
stub nvim '[ -e "$HOME/crashed" ] && exit 0; touch "$HOME/crashed"; exit 139'
|
||||||
|
|
||||||
|
run update_neovim
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
[[ "$output" == *"Neovim crashed (signal 11)"* ]]
|
||||||
|
[ "$(grep -c '^nvim ' "$STUB_LOG")" -eq 2 ]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "a sync that crashes Neovim twice fails" {
|
||||||
|
plugin lazy.nvim
|
||||||
|
stub nvim 'exit 139'
|
||||||
|
|
||||||
|
run update_neovim
|
||||||
|
[ "$status" -eq 139 ]
|
||||||
|
[ "$(grep -c '^nvim ' "$STUB_LOG")" -eq 2 ]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "a sync that fails without crashing isn't run again" {
|
||||||
|
plugin lazy.nvim
|
||||||
|
stub nvim 'exit 1'
|
||||||
|
|
||||||
|
run update_neovim
|
||||||
|
[ "$status" -eq 1 ]
|
||||||
|
[ "$(grep -c '^nvim ' "$STUB_LOG")" -eq 1 ]
|
||||||
|
}
|
||||||
|
|||||||
@@ -33,5 +33,15 @@ set_aside_broken_plugins() {
|
|||||||
run_update() {
|
run_update() {
|
||||||
echo "Updating Neovim plugins..."
|
echo "Updating Neovim plugins..."
|
||||||
set_aside_broken_plugins
|
set_aside_broken_plugins
|
||||||
|
# Neovim has crashed on the way out after a finished sync (a segfault on
|
||||||
|
# 0.12.6, report CD-P8RUBS, 2026-11-11). If it dies from a signal, sync once
|
||||||
|
# more: that finishes anything left over, and fails if it crashes again.
|
||||||
|
local status=0
|
||||||
|
nvim --headless "+Lazy! sync" +qa || status=$?
|
||||||
|
if [ "$status" -gt 128 ]; then
|
||||||
|
echo " Neovim crashed (signal $((status - 128))), so syncing the plugins once more..."
|
||||||
nvim --headless "+Lazy! sync" +qa
|
nvim --headless "+Lazy! sync" +qa
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
return "$status"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user