diff --git a/lua/neotest-python/pytest.lua b/lua/neotest-python/pytest.lua index 91fbaa7..3b3e950 100644 --- a/lua/neotest-python/pytest.lua +++ b/lua/neotest-python/pytest.lua @@ -37,15 +37,15 @@ local socket_start = nio.control.future() -- @return string: Concatenated response from server local function get_socket_path(cmd, messages, callback) -- 1. Run the command and capture its output (socket path) - local stdout = assert(vim.uv.new_pipe()) - local stderr = assert(vim.uv.new_pipe()) - local stdin = assert(vim.uv.new_pipe()) if socket_path == "" and not socket_start.is_set() then + local stdout = assert(vim.uv.new_pipe(true)) + local stderr = assert(vim.uv.new_pipe(true)) + local stdin = assert(vim.uv.new_pipe(true)) socket_start.set() local handle handle, _ = vim.uv.spawn(cmd[1], { stdio = { stdin, stdout, stderr }, - detached = false, + detached = true, args = #cmd > 1 and vim.list_slice(cmd, 2, #cmd) or { cmd[1] }, }, function(code, signal) vim.uv.close(stdout) diff --git a/neotest_python/params_getter.py b/neotest_python/params_getter.py index 8f0ba13..1f21eab 100644 --- a/neotest_python/params_getter.py +++ b/neotest_python/params_getter.py @@ -136,7 +136,7 @@ async def serve_socket(): if python_socket_path.exists(): print(python_socket_path) - return + atexit.register(lambda: _close_socket(python_socket_path)) signal.signal(signal.SIGTERM, lambda x, _: _close_socket(python_socket_path))