Skip to content

Commit aafc8dd

Browse files
committed
fix: check container runtime is available in stop, restart and logs
run_detached and run_foreground both call check_available before they touch the runtime, which routes a missing binary through not_installed_error and produces an actionable message. stop, restart and logs spawned the binary directly, so on a host without the configured runtime they failed with a bare os error 2 that does not name what was missing.
1 parent 53ef0fa commit aafc8dd

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

crates/cli/src/local_runtime.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,13 +314,15 @@ impl LocalRuntime {
314314
}
315315

316316
pub fn stop(&self, instance_name: &str) -> Result<bool> {
317+
Self::check_available(self.runtime)?;
317318
let name = self.container_name(instance_name);
318319
let removed_helix = self.remove_container(&name)?;
319320
let removed_disk_resources = self.remove_disk_resources(instance_name, false)?;
320321
Ok(removed_helix || removed_disk_resources)
321322
}
322323

323324
pub fn restart(&self, instance_name: &str, config: &LocalInstanceConfig) -> Result<()> {
325+
Self::check_available(self.runtime)?;
324326
if config.storage.is_disk() || config.storage.is_s3() {
325327
return self.run_detached(instance_name, config);
326328
}
@@ -341,6 +343,7 @@ impl LocalRuntime {
341343
}
342344

343345
pub fn logs(&self, instance_name: &str, follow: bool) -> Result<()> {
346+
Self::check_available(self.runtime)?;
344347
let name = self.container_name(instance_name);
345348
let mut command = self.runtime_command();
346349
command.arg("logs");

0 commit comments

Comments
 (0)