fix(lua): extra CR (\r) in nvim -l output #38048

Problem:
`nvim -l` prints an extra `\r` to stdout:

    :=vim.system({'cmd', '/c',  "echo print(1) | nvim -l -"}, {}):wait()
    {
      code = 0,
      signal = 0,
      stderr = "1\r\r\n",
      stdout = ""
    }

Solution:
Check `headless_mode` in `msg_use_crlf`.

Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
This commit is contained in:
Commrade Goad
2026-03-11 06:01:45 +07:00
committed by GitHub
parent e23c083d13
commit 66066d0f6a
3 changed files with 15 additions and 7 deletions

View File

@@ -253,7 +253,7 @@ describe(':Man', function()
matches('^/.+', actual_file)
local args = { nvim_prog, '--headless', '+:Man ' .. actual_file, '+q' }
matches(
('Error in command line:\r\n' .. 'man.lua: no manual entry for %s'):format(pesc(actual_file)),
('Error in command line:\n' .. 'man.lua: no manual entry for %s'):format(pesc(actual_file)),
fn.system(args, { '' })
)
os.remove(actual_file)