MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / wait_for_path

Function wait_for_path

crates/openshell-driver-vm/src/runtime.rs:1223–1238  ·  view source on GitHub ↗
(path: &Path, timeout: Duration, label: &str)

Source from the content-addressed store, hash-verified

1221}
1222
1223fn wait_for_path(path: &Path, timeout: Duration, label: &str) -> Result<(), String> {
1224 let deadline = Instant::now() + timeout;
1225 let mut interval = Duration::from_millis(5);
1226 while !path.exists() {
1227 if Instant::now() >= deadline {
1228 return Err(format!(
1229 "{label} did not appear within {:.1}s: {}",
1230 timeout.as_secs_f64(),
1231 path.display()
1232 ));
1233 }
1234 std::thread::sleep(interval);
1235 interval = (interval * 2).min(Duration::from_millis(200));
1236 }
1237 Ok(())
1238}
1239
1240fn hash_path_id(path: &Path) -> String {
1241 let mut hash: u64 = 0xcbf2_9ce4_8422_2325;

Callers 1

run_libkrun_vmFunction · 0.85

Calls 1

existsMethod · 0.80

Tested by

no test coverage detected