From 8fc81bc9e975ef8036b46149b889d711feafdb17 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 1 Feb 2026 08:14:12 +0800 Subject: [PATCH] test: wait for uv.pipe_connect() callback (#37640) Problem: On Windows, writing to a pipe doesn't work if the pipe isn't connected yet. This causes an RPC request to a session newly created by connect() to hang, as it's waiting for a response to a request that never reaches the server. Solution: Wait for uv.pipe_connect() callback to be called when using connect(). --- test/client/uv_stream.lua | 7 +++++++ test/functional/ui/embed_spec.lua | 2 -- test/functional/ui/messages_spec.lua | 1 - 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/test/client/uv_stream.lua b/test/client/uv_stream.lua index 6e1a6995be..af0abd37a9 100644 --- a/test/client/uv_stream.lua +++ b/test/client/uv_stream.lua @@ -67,8 +67,15 @@ function SocketStream.open(file) _stream_error = nil, }, SocketStream) uv.pipe_connect(socket, file, function(err) + uv.stop() self._stream_error = self._stream_error or err end) + -- On Windows, writing to the pipe doesn't work if it's not connected yet, + -- so wait for the connect callback to be called. + uv.run() + if self._stream_error then + error(self._stream_error) + end return self end diff --git a/test/functional/ui/embed_spec.lua b/test/functional/ui/embed_spec.lua index 6d8b629bf3..6b5acaa1c6 100644 --- a/test/functional/ui/embed_spec.lua +++ b/test/functional/ui/embed_spec.lua @@ -284,7 +284,6 @@ describe('--embed UI', function() end) it('closing stdio with another remote UI does not leak memory #36392', function() - t.skip(t.is_os('win'), 'n.connect() hangs on Windows') clear({ args_rm = { '--headless' } }) Screen.new() eq(1, #api.nvim_list_uis()) @@ -299,7 +298,6 @@ end) describe('--embed --listen UI', function() it('waits for connection on listening address', function() - t.skip(t.is_os('win')) clear() local child_server = assert(n.new_pipename()) fn.jobstart({ diff --git a/test/functional/ui/messages_spec.lua b/test/functional/ui/messages_spec.lua index 3e53b6b870..02b0391519 100644 --- a/test/functional/ui/messages_spec.lua +++ b/test/functional/ui/messages_spec.lua @@ -3350,7 +3350,6 @@ aliquip ex ea commodo consequat.]] end) it('pager works in headless mode with UI attached', function() - skip(is_os('win'), 'n.connect() hangs on Windows') clear() local child_server = assert(n.new_pipename()) fn.jobstart({ nvim_prog, '--clean', '--headless', '--listen', child_server })