diff options
author | Enan Ajmain <3nan.ajmain@gmail.com> | 2023-05-07 20:44:03 +0600 |
---|---|---|
committer | Enan Ajmain <3nan.ajmain@gmail.com> | 2023-05-07 20:58:20 +0600 |
commit | 4bfc7802f056c2e1284edad3f8b7943f7f25d493 (patch) | |
tree | 578ad2aa3a648ce80388f2252479d67b04a209ae /src/nvim/main.c | |
parent | fa1baa9a47cdb3eed17d48b6011a164d4009d2ee (diff) | |
download | rneovim-4bfc7802f056c2e1284edad3f8b7943f7f25d493.tar.gz rneovim-4bfc7802f056c2e1284edad3f8b7943f7f25d493.tar.bz2 rneovim-4bfc7802f056c2e1284edad3f8b7943f7f25d493.zip |
fix(windows): set stdout to binary mode for --api-info
Problem: --api-info output is binary. Not setting the mode may cause
the OS to impose unexpected eof. For Windows, it scatters extra '0d0a'
words in the output.
Solution: On Windows, set stdout to binary mode for --api-info.
Fixes #20977
Diffstat (limited to 'src/nvim/main.c')
-rw-r--r-- | src/nvim/main.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/nvim/main.c b/src/nvim/main.c index 4b96f5839d..ee643adab5 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -1056,6 +1056,10 @@ static void command_line_scan(mparm_T *parmp) version(); os_exit(0); } else if (STRICMP(argv[0] + argv_idx, "api-info") == 0) { +#ifdef MSWIN + // set stdout to binary to avoid crlf in --api-info output + _setmode(STDOUT_FILENO, _O_BINARY); +#endif FileDescriptor fp; const int fof_ret = file_open_fd(&fp, STDOUT_FILENO, kFileWriteOnly); |