diff --git a/src/vm.rs b/src/vm.rs index 9567c49..ad02309 100644 --- a/src/vm.rs +++ b/src/vm.rs @@ -76,9 +76,10 @@ pub fn run(h: &Path, o: Opts, image: &str, cmd: Vec, extra: &[String], g } if !disk.exists() { eprintln!("wsbx: creating sandbox {name}"); - create_disk(h, &disk, o.disk)?; + // meta first: it marks the image as in use for `wsbx gc` and makes a crashed create visible to ps/rm meta = json!({"image": image, "digest": img.digest, "workspace": ws, "created": now(), "provisioned": false}); fs::write(&meta_path, serde_json::to_vec_pretty(&meta)?)?; + create_disk(h, &disk, o.disk)?; } // Build the guest-side run script (executed as root by init, then drops to the image user).