fix: writePipe loses data on partial write > PIPE_BUF

This commit is contained in:
2026-08-06 17:01:30 +03:00
committed by andrey
parent 736acbd419
commit cb5530c864
+10 -1
View File
@@ -242,7 +242,16 @@ PRIVATE_DEFINITION_START(PIProcess)
BOOL ok = WriteFile(pipes[StdIn][PipeWrite], data.data(), data.size(), &sz, NULL);
if (!ok) sz = 0;
# else
sz = ::write(pipes[StdIn][PipeWrite], data.data(), data.size());
size_t offset = 0;
while (offset < data.size()) {
ssize_t wr = ::write(pipes[StdIn][PipeWrite], data.data() + offset, data.size() - offset);
if (wr < 0) {
if (errno == EINTR) continue;
return false;
}
offset += wr;
}
sz = offset;
# endif
return sz == (SizeType)data.size_s();
}