Skip to content

Commit

Permalink
Made it work with 1.85.0-nightly, hopefully more versions too
Browse files Browse the repository at this point in the history
  • Loading branch information
AverseABFun committed Dec 7, 2024
1 parent c15c47d commit 21f59b6
Showing 3 changed files with 33 additions and 16 deletions.
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -28,3 +28,6 @@ parking_lot = "0.12"

[features]
backtrace = ["error-chain/backtrace"]

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(has_error_description_deprecated)'] }
7 changes: 6 additions & 1 deletion src/flock.rs
Original file line number Diff line number Diff line change
@@ -115,7 +115,12 @@ impl Filesystem {
)?;
}
State::Shared => {
acquire(msg, &path, &|| f.try_lock_shared(), &|| f.lock_shared())?;
acquire(msg, &path, &|| {
match f.try_lock_shared() {
Ok(_) => Ok(()),
Err(err) => Err(err)
}
} , &|| f.lock_shared())?;
}
}

39 changes: 24 additions & 15 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
#![deny(warnings)]
#![feature(file_lock)]

#[macro_use]
extern crate error_chain;
extern crate dirs;
extern crate fs2;
#[cfg(any(all(target_os = "linux", not(target_env = "musl")), target_os = "macos"))]
#[cfg(any(
all(target_os = "linux", not(target_env = "musl")),
target_os = "macos"
))]
extern crate libc;
extern crate rustc_version;
extern crate serde_json;
extern crate tempdir;
extern crate toml;
extern crate walkdir;
extern crate dirs;

use std::hash::{Hash, Hasher};
use std::io::Write;
use std::path::{Path};
use std::path::Path;
use std::process::ExitStatus;
use std::{env, io, process};

@@ -100,9 +104,11 @@ pub fn main_inner(xargo_mode: XargoMode) {

process::exit(1)
}
Ok(Some(status)) => if !status.success() {
process::exit(status.code().unwrap_or(1))
},
Ok(Some(status)) => {
if !status.success() {
process::exit(status.code().unwrap_or(1))
}
}
Ok(None) => {}
}
}
@@ -122,7 +128,8 @@ fn run(cargo_mode: XargoMode) -> Result<Option<ExitStatus>> {
io::stderr(),
concat!("xargo ", env!("CARGO_PKG_VERSION"), "{}"),
include_str!(concat!(env!("OUT_DIR"), "/commit-info.txt"))
).ok();
)
.ok();

return cargo::run(&args, verbose).map(Some);
}
@@ -136,11 +143,13 @@ fn run(cargo_mode: XargoMode) -> Result<Option<ExitStatus>> {
"The XARGO_RUST_SRC env variable must be set and point to the \
Rust source directory when working with the 'dev' channel",
)?,
Channel::Nightly => if let Some(src) = rustc::Src::from_env() {
src
} else {
sysroot.src()?
},
Channel::Nightly => {
if let Some(src) = rustc::Src::from_env() {
src
} else {
sysroot.src()?
}
}
Channel::Stable | Channel::Beta => {
eprintln!(
"ERROR: the sysroot can't be built for the {:?} channel. \
@@ -199,13 +208,13 @@ fn run(cargo_mode: XargoMode) -> Result<Option<ExitStatus>> {
&meta,
config.as_ref(),
verbose,
).map(Some);
)
.map(Some);
} else {
return Ok(None)
return Ok(None);
}
}
}

cargo::run(&args, verbose).map(Some)
}

0 comments on commit 21f59b6

Please sign in to comment.