From 8aff897563076d607e6a4d0d6287adb7724c6273 Mon Sep 17 00:00:00 2001 From: Juraj Kirchheim Date: Thu, 15 Oct 2026 08:51:06 +0100 Subject: [PATCH] Do not fsync stdout and stderr in Sys.flush writeSync already hands the bytes to the kernel, so FileOutput has no buffer and inherits Output.flush. fsync is not that flush, and the kernel returns EINVAL when the descriptor is a pipe or a terminal. --- src/Sys.hx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Sys.hx b/src/Sys.hx index e423a65d..8b7e610e 100644 --- a/src/Sys.hx +++ b/src/Sys.hx @@ -136,9 +136,9 @@ private class FileOutput extends haxe.io.Output { Fs.writeSync(fd, s); } - override public function flush() { - Fs.fsyncSync(fd); - } + // No flush override: writeSync already hands the bytes to the kernel, so + // nothing is buffered. fsync is not flush, and it returns EINVAL on a + // pipe or a terminal. override public function close() { Fs.closeSync(fd);