mirror of https://github.com/helix-editor/helix
Merge 75a935203c
into 395a71bf53
commit
640534f768
|
@ -1065,7 +1065,21 @@ impl Document {
|
||||||
let write_result: anyhow::Result<_> = async {
|
let write_result: anyhow::Result<_> = async {
|
||||||
let mut dst = tokio::fs::File::create(&write_path).await?;
|
let mut dst = tokio::fs::File::create(&write_path).await?;
|
||||||
to_writer(&mut dst, encoding_with_bom_info, &text).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(())
|
Ok(())
|
||||||
}
|
}
|
||||||
.await;
|
.await;
|
||||||
|
|
Loading…
Reference in New Issue