From 1ee5ab30853cc23a96965456a1fff18e67349dd3 Mon Sep 17 00:00:00 2001 From: clubby789 Date: Thu, 7 Nov 2024 17:28:16 +0000 Subject: [PATCH] bootstrap: Print better message if lock pid isn't available --- src/bootstrap/src/bin/main.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/bootstrap/src/bin/main.rs b/src/bootstrap/src/bin/main.rs index e9ec79e417b..409a644b9be 100644 --- a/src/bootstrap/src/bin/main.rs +++ b/src/bootstrap/src/bin/main.rs @@ -33,7 +33,7 @@ fn main() { // Display PID of process holding the lock // PID will be stored in a lock file 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() .write(true) @@ -47,7 +47,11 @@ fn main() { } 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()); t!(lock.write(process::id().to_string().as_ref())); lock