From e2c50f7e8ada214f3a44a49da2faa0716d24970e Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Wed, 21 Aug 2024 07:25:17 -0700 Subject: fix(upgrade): better error message when check_exe fails (#25133) Fixes https://github.com/denoland/deno/issues/24971 Fixes the panic. We can give a more personalized error by checking the macOS version but probably not worth the effort. --- cli/tools/upgrade.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'cli') diff --git a/cli/tools/upgrade.rs b/cli/tools/upgrade.rs index db43b8be1..50d6395fc 100644 --- a/cli/tools/upgrade.rs +++ b/cli/tools/upgrade.rs @@ -972,8 +972,13 @@ fn check_exe(exe_path: &Path) -> Result<(), AnyError> { .arg("-V") .stderr(std::process::Stdio::inherit()) .output()?; - assert!(output.status.success()); - Ok(()) + if !output.status.success() { + bail!( + "Failed to validate Deno executable. This may be because your OS is unsupported or the executable is corrupted" + ) + } else { + Ok(()) + } } #[derive(Debug)] -- cgit v1.2.3