From 1fcf743b10135a54969629e99743bdde2ab3267f Mon Sep 17 00:00:00 2001 From: Jamie Gaskins Date: Thu, 28 Nov 2024 12:19:13 -0600 Subject: [PATCH 1/2] Set IO to be synchronous for `File` by default --- src/crystal/system/unix/file_descriptor.cr | 1 + 1 file changed, 1 insertion(+) diff --git a/src/crystal/system/unix/file_descriptor.cr b/src/crystal/system/unix/file_descriptor.cr index 4aa1ec580d32..bdaece96145e 100644 --- a/src/crystal/system/unix/file_descriptor.cr +++ b/src/crystal/system/unix/file_descriptor.cr @@ -36,6 +36,7 @@ module Crystal::System::FileDescriptor private def system_blocking_init(value) self.system_blocking = false unless value + self.sync = value end private def system_close_on_exec? From e764834de60e38de89aa575ff1a62884249dccc2 Mon Sep 17 00:00:00 2001 From: Jamie Gaskins Date: Thu, 28 Nov 2024 12:33:04 -0600 Subject: [PATCH 2/2] Set sync values for Win32 and WASI, as well --- src/crystal/system/wasi/file_descriptor.cr | 1 + src/crystal/system/win32/file_descriptor.cr | 1 + 2 files changed, 2 insertions(+) diff --git a/src/crystal/system/wasi/file_descriptor.cr b/src/crystal/system/wasi/file_descriptor.cr index 890e6363605c..ef71b54393f2 100644 --- a/src/crystal/system/wasi/file_descriptor.cr +++ b/src/crystal/system/wasi/file_descriptor.cr @@ -18,6 +18,7 @@ module Crystal::System::FileDescriptor end private def system_blocking_init(value) + self.sync = value end private def system_reopen(other : IO::FileDescriptor) diff --git a/src/crystal/system/win32/file_descriptor.cr b/src/crystal/system/win32/file_descriptor.cr index 4265701cd8b2..12fb29014fe1 100644 --- a/src/crystal/system/win32/file_descriptor.cr +++ b/src/crystal/system/win32/file_descriptor.cr @@ -101,6 +101,7 @@ module Crystal::System::FileDescriptor private def system_blocking_init(value) @system_blocking = value + self.sync = value Crystal::EventLoop.current.create_completion_port(windows_handle) unless value end