Skip to content

Commit 1ee5ab3

Browse files
committed
bootstrap: Print better message if lock pid isn't available
1 parent fe43131 commit 1ee5ab3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/bootstrap/src/bin/main.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ fn main() {
3333
// Display PID of process holding the lock
3434
// PID will be stored in a lock file
3535
let lock_path = config.out.join("lock");
36-
let pid = fs::read_to_string(&lock_path).unwrap_or_default();
36+
let pid = fs::read_to_string(&lock_path);
3737

3838
build_lock = fd_lock::RwLock::new(t!(fs::OpenOptions::new()
3939
.write(true)
@@ -47,7 +47,11 @@ fn main() {
4747
}
4848
err => {
4949
drop(err);
50-
println!("WARNING: build directory locked by process {pid}, waiting for lock");
50+
if let Ok(pid) = pid {
51+
println!("WARNING: build directory locked by process {pid}, waiting for lock");
52+
} else {
53+
println!("WARNING: build directory locked, waiting for lock");
54+
}
5155
let mut lock = t!(build_lock.write());
5256
t!(lock.write(process::id().to_string().as_ref()));
5357
lock

0 commit comments

Comments
 (0)