aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-12-21 10:39:10 +0800
committerGitHub <noreply@github.com>2023-12-21 10:39:10 +0800
commit342c7da4bd2c60796d722970f82300b6d5ba0b42 (patch)
tree29f01a6a394f7ad4c0afdb1db09a85f1b2872208
parent0c120307ca1ab613e63865c634d7e10ad67fb0ba (diff)
downloadrneovim-342c7da4bd2c60796d722970f82300b6d5ba0b42.tar.gz
rneovim-342c7da4bd2c60796d722970f82300b6d5ba0b42.tar.bz2
rneovim-342c7da4bd2c60796d722970f82300b6d5ba0b42.zip
fix(channel): use os_write() instead of fwrite() for stderr (#26689)
This handles EAGAIN. Related #26688
-rw-r--r--src/nvim/channel.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/nvim/channel.c b/src/nvim/channel.c
index 8c4fa8f5ad..e62c240636 100644
--- a/src/nvim/channel.c
+++ b/src/nvim/channel.c
@@ -30,6 +30,7 @@
#include "nvim/message.h"
#include "nvim/msgpack_rpc/channel.h"
#include "nvim/msgpack_rpc/server.h"
+#include "nvim/os/fs.h"
#include "nvim/os/os_defs.h"
#include "nvim/os/shell.h"
#include "nvim/path.h"
@@ -574,7 +575,10 @@ size_t channel_send(uint64_t id, char *data, size_t len, bool data_owned, const
goto retfree;
}
// unbuffered write
- written = len * fwrite(data, len, 1, stderr);
+ ptrdiff_t wres = os_write(STDERR_FILENO, data, len, false);
+ if (wres >= 0) {
+ written = (size_t)wres;
+ }
goto retfree;
}