Rollup merge of #132737 - clubby789:lock-no-pid, r=jieyouxu
bootstrap: Print better message if lock pid isn't available Not actually sure why, but sometimes the PID isn't available so we print ``` WARNING: build directory locked by process , waiting for lock ``` This makes the message a bit nicer in this case
This commit is contained in:
commit
5b554613ed
@ -33,7 +33,7 @@ fn main() {
|
|||||||
// Display PID of process holding the lock
|
// Display PID of process holding the lock
|
||||||
// PID will be stored in a lock file
|
// PID will be stored in a lock file
|
||||||
let lock_path = config.out.join("lock");
|
let lock_path = config.out.join("lock");
|
||||||
let pid = fs::read_to_string(&lock_path).unwrap_or_default();
|
let pid = fs::read_to_string(&lock_path);
|
||||||
|
|
||||||
build_lock = fd_lock::RwLock::new(t!(fs::OpenOptions::new()
|
build_lock = fd_lock::RwLock::new(t!(fs::OpenOptions::new()
|
||||||
.write(true)
|
.write(true)
|
||||||
@ -47,7 +47,11 @@ fn main() {
|
|||||||
}
|
}
|
||||||
err => {
|
err => {
|
||||||
drop(err);
|
drop(err);
|
||||||
println!("WARNING: build directory locked by process {pid}, waiting for lock");
|
if let Ok(pid) = pid {
|
||||||
|
println!("WARNING: build directory locked by process {pid}, waiting for lock");
|
||||||
|
} else {
|
||||||
|
println!("WARNING: build directory locked, waiting for lock");
|
||||||
|
}
|
||||||
let mut lock = t!(build_lock.write());
|
let mut lock = t!(build_lock.write());
|
||||||
t!(lock.write(process::id().to_string().as_ref()));
|
t!(lock.write(process::id().to_string().as_ref()));
|
||||||
lock
|
lock
|
||||||
|
Loading…
Reference in New Issue
Block a user