Files
neovim/runtime
zeertzjq ab8371a26c fix(tui): server --listen error sometimes not visible (#38027)
Problem:  If Nvim server fails to --listen and prints error before the
          TUI enters alternate screen, the error isn't visible.
Solution: Forward server stderr using client side stderr handler instead
          of having the server inherit client stderr file descriptor.

This does mean that `stderr_isatty` will be `false` in the server, but
that value doesn't matter in embedded mode.

Always pass `stdin_fd` to embedded server to avoid a hang when reading
from stdin when it's a TTY (not sure why one wants to do that, perhaps
by mistake), because if `stdin_fd` isn't passed, the server will try to
use stderr as stdin.

Example test failure on CI:

FAILED   test/functional/terminal/tui_spec.lua @ 41: TUI exit status 1 and error message with server --listen error #34365
test/functional/terminal\tui_spec.lua:55: Failed to match any screen lines.
Expected (anywhere): "nvim%.exe: Failed to %-%-listen: address already in use:"
Actual:
  |{114:nvim.exe -h"}                                                |
  |                                                            |
  |[Process exited 1]^                                          |
  |                                                            |
  |                                                            |
  |                                                            |
  |                                                            |
  |                                                            |
  |                                                            |
  |                                                            |
  |                                                            |
  |                                                            |
  |                                                            |
  |                                                            |
  |                                                            |
  |                                                            |
  |{5:-- TERMINAL --}                                              |

Snapshot:
screen:expect([[
  {114:nvim.exe -h"}                                                |
                                                              |
  [Process exited 1]^                                          |
                                                              |*13
  {5:-- TERMINAL --}                                              |
]])

stack traceback:
	test\functional\ui\screen.lua:909: in function '_wait'
	test\functional\ui\screen.lua:537: in function 'expect'
	test/functional/terminal\tui_spec.lua:55: in function <test/functional/terminal\tui_spec.lua:41>

In this case, it appears that the client entered alternate screen in the
middle of the server's print_mainerr().
2026-03-02 20:39:05 +08:00
..
2026-02-12 13:46:45 +01:00
2026-01-07 08:11:42 +08:00
2023-08-13 13:25:10 +01:00
2026-01-27 09:18:02 -05:00
2023-08-13 13:25:10 +01:00
2023-08-13 13:25:10 +01:00
2023-08-13 13:25:10 +01:00
2023-08-13 13:25:10 +01:00
2023-08-13 13:25:10 +01:00
2025-03-26 14:48:09 +01:00