Skip to content

Commit 8b2f583

Browse files
fix: Ignore unsupported errors when trying to flush saved files to disk (#12723)
1 parent 4418e33 commit 8b2f583

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

helix-view/src/document.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1065,7 +1065,21 @@ impl Document {
10651065
let write_result: anyhow::Result<_> = async {
10661066
let mut dst = tokio::fs::File::create(&write_path).await?;
10671067
to_writer(&mut dst, encoding_with_bom_info, &text).await?;
1068-
dst.sync_all().await?;
1068+
// Ignore ENOTSUP/EOPNOTSUPP (Operation not supported) errors from sync_all()
1069+
// This is known to occur on SMB filesystems on macOS where fsync is not supported
1070+
if let Err(e) = dst.sync_all().await {
1071+
#[cfg(target_os = "macos")]
1072+
{
1073+
match e.raw_os_error() {
1074+
Some(45) | Some(102) => {}, // ENOTSUP or EOPNOTSUPP - ignore
1075+
_ => return Err(e.into()),
1076+
}
1077+
}
1078+
#[cfg(not(target_os = "macos"))]
1079+
{
1080+
return Err(e.into());
1081+
}
1082+
}
10691083
Ok(())
10701084
}
10711085
.await;

0 commit comments

Comments
 (0)