Skip to content

Commit 941f488

Browse files
authored
Auto merge of #2720 - alexcrichton:ignore-nfs-more-often, r=brson
Ignore file locks on OSX NFS mounts We already ignore NFS on Linux so let's do the same on OSX as well.
2 parents b742d5c + c8abb20 commit 941f488

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/cargo/util/flock.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ use std::path::{Path, PathBuf, Display};
55

66
use term::color::CYAN;
77
use fs2::{FileExt, lock_contended_error};
8+
#[allow(unused_imports)]
9+
use libc;
810

911
use util::{CargoResult, ChainError, Config, human};
1012

@@ -267,6 +269,13 @@ fn acquire(config: &Config,
267269

268270
match try() {
269271
Ok(()) => return Ok(()),
272+
273+
// Like above, where we ignore file locking on NFS mounts on Linux, we
274+
// do the same on OSX here. Note that ENOTSUP is an OSX_specific
275+
// constant.
276+
#[cfg(target_os = "macos")]
277+
Err(ref e) if e.raw_os_error() == Some(libc::ENOTSUP) => return Ok(()),
278+
270279
Err(e) => {
271280
if e.raw_os_error() != lock_contended_error().raw_os_error() {
272281
return Err(human(e)).chain_error(|| {
@@ -287,7 +296,6 @@ fn acquire(config: &Config,
287296
use std::ffi::CString;
288297
use std::mem;
289298
use std::os::unix::prelude::*;
290-
use libc;
291299

292300
let path = match CString::new(path.as_os_str().as_bytes()) {
293301
Ok(path) => path,

0 commit comments

Comments
 (0)