Rollup merge of #136009 - clubby789:pidfile-race, r=jieyouxu

bootstrap: Handle bootstrap lockfile race condition better

Fixes #135972

Tested by:
- Starting one build
- In another terminal, `echo -n '' > build/lock`
- Attempt to invoke bootstrap a second time
This commit is contained in:
Matthias Krüger 2025-01-25 08:03:36 +01:00 committed by GitHub
commit 6cb2820b7e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -57,7 +57,9 @@ fn main() {
}
err => {
drop(err);
if let Ok(pid) = pid {
// #135972: We can reach this point when the lock has been taken,
// but the locker has not yet written its PID to the file
if let Some(pid) = pid.ok().filter(|pid| !pid.is_empty()) {
println!("WARNING: build directory locked by process {pid}, waiting for lock");
} else {
println!("WARNING: build directory locked, waiting for lock");