aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--crates/shirabe/src/util/perforce.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/crates/shirabe/src/util/perforce.rs b/crates/shirabe/src/util/perforce.rs
index cd384fc..d84e4ea 100644
--- a/crates/shirabe/src/util/perforce.rs
+++ b/crates/shirabe/src/util/perforce.rs
@@ -842,14 +842,12 @@ impl Perforce {
}
fn get_p4_executable() -> String {
- // TODO(phase-b): emulate PHP `static $p4Executable;` — cache across calls
static P4_EXECUTABLE: std::sync::OnceLock<String> = std::sync::OnceLock::new();
+
P4_EXECUTABLE
.get_or_init(|| {
let finder = ExecutableFinder::new();
- finder
- .find("p4", None, &[])
- .unwrap_or_else(|| "p4".to_string())
+ finder.find("p4", None, &[]).unwrap_or("p4".to_string())
})
.clone()
}