From 781ea5b41b2da54c13968c7082a87870fa8e8e35 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 25 Mar 2026 10:03:23 +0800 Subject: [PATCH] fix(exit): stop listening before closing channels (#38480) Fixes the following flaky test on FreeBSD: FAILED test/functional/terminal/tui_spec.lua @ 218: TUI :restart works test/functional/testterm.lua:223: Row 1 did not match. Expected: |*^ | |*{100:~ }| |*{100:~ }| |*{100:~ }| |*{3:[No Name] }| |*{MATCH:%d+ +}| |{5:-- TERMINAL --} | Actual: |*nvim: Failed to --listen: address already in use: | |*"/tmp/cirrus-ci-build/build/Xtest_tmpdir_terminal/| |*nvim.cirrus/LLdBdg/nvim.18878.1" | |* More info with "nv| |*im -h" | |*[Proce^ss exited 1] | |{5:-- TERMINAL --} | --- src/nvim/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nvim/main.c b/src/nvim/main.c index ebb1ea5083..7304b77ae6 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -178,10 +178,10 @@ static bool event_teardown(void) multiqueue_process_events(main_loop.events); loop_poll_events(&main_loop, 0); // Drain thread_events, fast_events. input_stop(); + server_teardown(); channel_teardown(); proc_teardown(&main_loop); timer_teardown(); - server_teardown(); signal_teardown(); terminal_teardown();