From 9c1e4eb51d952ed8ba9fe03a93b4111d522a1d87 Mon Sep 17 00:00:00 2001 From: per1234 Date: Fri, 25 Aug 2023 00:59:41 -0700 Subject: [PATCH] Print error message on certificate flash failure 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 $ 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) } }