Skip to content

Do not fsync stdout and stderr in Sys.flush - #273

Open
back2dos wants to merge 1 commit into
HaxeFoundation:masterfrom
back2dos:stdout-flush
Open

back2dos wants to merge 1 commit into
HaxeFoundation:masterfrom
back2dos:stdout-flush

Conversation

@back2dos

Copy link
Copy Markdown
Member

Right now we use writeSync, which already does the kernel call. The fsync is a noop for FS and throws EINVAL for pipes.

The proper way to implement this would be to have in-memory buffers, with manual flush, plus automatic flush when the buffer is full, or the file closes or all the other things that should flush the buffer. But I didn't wanna go there. This change is minimal and causes no regressions.

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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant