From 8b2f5834a6cdda58272b86c60d5c8ac35a22048a Mon Sep 17 00:00:00 2001 From: Charles Duffy Date: Fri, 18 Jul 2025 17:25:37 -0500 Subject: [PATCH] fix: Ignore unsupported errors when trying to flush saved files to disk (#12723) --- helix-view/src/document.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs index 04b7703c5..3fcdfa8e6 100644 --- a/helix-view/src/document.rs +++ b/helix-view/src/document.rs @@ -1065,7 +1065,21 @@ impl Document { let write_result: anyhow::Result<_> = async { let mut dst = tokio::fs::File::create(&write_path).await?; to_writer(&mut dst, encoding_with_bom_info, &text).await?; - dst.sync_all().await?; + // Ignore ENOTSUP/EOPNOTSUPP (Operation not supported) errors from sync_all() + // This is known to occur on SMB filesystems on macOS where fsync is not supported + if let Err(e) = dst.sync_all().await { + #[cfg(target_os = "macos")] + { + match e.raw_os_error() { + Some(45) | Some(102) => {}, // ENOTSUP or EOPNOTSUPP - ignore + _ => return Err(e.into()), + } + } + #[cfg(not(target_os = "macos"))] + { + return Err(e.into()); + } + } Ok(()) } .await;