From 97ec422f22d069b9570931834241c7e47bc68cc3 Mon Sep 17 00:00:00 2001 From: Amr Bashir Date: Thu, 2 May 2024 14:26:53 +0300 Subject: [PATCH] fix(cli/icon): return with an error instead of panic (#9638) * fix(cli/icon): return with an error instead of panic closes #9636 * Update .changes/cli-icon-non-0-exit.md --- .changes/cli-icon-non-0-exit.md | 6 ++++++ tooling/cli/src/icon.rs | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 .changes/cli-icon-non-0-exit.md diff --git a/.changes/cli-icon-non-0-exit.md b/.changes/cli-icon-non-0-exit.md new file mode 100644 index 000000000..8b9826cea --- /dev/null +++ b/.changes/cli-icon-non-0-exit.md @@ -0,0 +1,6 @@ +--- +"tauri-cli": "patch:bug" +"@tauri-apps/cli": "patch:bug" +--- + +Exit `tauri icon` with non-zero code when it fails. diff --git a/tooling/cli/src/icon.rs b/tooling/cli/src/icon.rs index ed3b33ac1..786f6bd25 100644 --- a/tooling/cli/src/icon.rs +++ b/tooling/cli/src/icon.rs @@ -138,11 +138,11 @@ pub fn command(options: Options) -> Result<()> { )) } } else { - panic!("Error loading image"); + anyhow::bail!("Error loading image"); }; if source.height() != source.width() { - panic!("Source image must be square"); + anyhow::bail!("Source image must be square"); } if png_icon_sizes.is_empty() {