From f07445fc5a50b1ea48c115ce97d6e1ee06016ecd Mon Sep 17 00:00:00 2001 From: per1234 Date: Mon, 28 Aug 2023 02:21:16 -0700 Subject: [PATCH] Print error message on certificate flash failure (#215) Previously, if there was a problem during the flashing stage of the certificate flash command invocation, Arduino Firmware Uploader would exit silently, giving the user no feedback that something had gone wrong other than a generic exit status 1: ``` $ touch /tmp/cert-with-unsupported-extension.crt # Create dummy certificate file. Valid certificate is not required for this demo. $ arduino-fwuploader certificates flash --address COM42 --file /tmp/cert-with-unsupported-extension.crt --fqbn arduino:renesas_uno:unor4wifi Converting and flashing certificate C:/Users/per/AppData/Local/Temp/cert-with-unsupported-extension.crt $ echo $? 1 ``` --- cli/certificates/flash.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/certificates/flash.go b/cli/certificates/flash.go index d657964..0ca00c0 100644 --- a/cli/certificates/flash.go +++ b/cli/certificates/flash.go @@ -85,7 +85,7 @@ func runFlash(certificateURLs, certificatePaths []string) { res, flashErr := flashCertificates(uploader, certificateURLs, certificatePaths) feedback.PrintResult(res) if flashErr != nil { - os.Exit(int(feedback.ErrGeneric)) + feedback.Fatal(fmt.Sprintf("Error during certificates flashing: %s", flashErr), feedback.ErrGeneric) } }