From dc24c3a0e840ca2e8fc26448bdc19171a920384f Mon Sep 17 00:00:00 2001 From: amrbashir Date: Thu, 2 May 2024 00:27:53 +0300 Subject: [PATCH 1/2] fix(cli/icon): return with an error instead of panic closes #9636 --- .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 000000000000..3f4a092c8cc5 --- /dev/null +++ b/.changes/cli-icon-non-0-exit.md @@ -0,0 +1,6 @@ +--- +"tauri-cli": "patch" +"@tauri-apps/cli": "patch" +--- + +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 ed3b33ac1ae5..786f6bd253b3 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() { From 89c793414e4a3300c99c130a95bae7f886eb9aba Mon Sep 17 00:00:00 2001 From: Amr Bashir Date: Thu, 2 May 2024 00:32:40 +0300 Subject: [PATCH 2/2] Update .changes/cli-icon-non-0-exit.md --- .changes/cli-icon-non-0-exit.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.changes/cli-icon-non-0-exit.md b/.changes/cli-icon-non-0-exit.md index 3f4a092c8cc5..8b9826ceaf9a 100644 --- a/.changes/cli-icon-non-0-exit.md +++ b/.changes/cli-icon-non-0-exit.md @@ -1,6 +1,6 @@ --- -"tauri-cli": "patch" -"@tauri-apps/cli": "patch" +"tauri-cli": "patch:bug" +"@tauri-apps/cli": "patch:bug" --- Exit `tauri icon` with non-zero code when it fails.