From b5ea086717b0b6d62256a7a15973666893b9149f Mon Sep 17 00:00:00 2001 From: Volker Schukai <volker.schukai@schukai.com> Date: Tue, 28 May 2024 18:00:54 +0200 Subject: [PATCH] fix: fix -e option on print #18 --- source/commandline.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/source/commandline.go b/source/commandline.go index 8b654e5..86f0fe3 100644 --- a/source/commandline.go +++ b/source/commandline.go @@ -214,6 +214,11 @@ func executeCommand() { version, err := getVersion() if err != nil { + + if arguments.Print.ExitCode { + os.Exit(10) + } + _, err := fmt.Fprintf(os.Stderr, "Error: %s\n", err) if err != nil { fmt.Printf("Error: %s\n", err) @@ -266,8 +271,8 @@ func executeCommand() { err = writeVersion(newVersion) if err != nil { - if activeCommand.Name == "auto" || activeCommand.Name == "predict" || activeCommand.Name == "print" { - if arguments.Auto.ExitCode || arguments.Predict.ExitCode || arguments.Print.ExitCode { + if activeCommand.Name == "auto" || activeCommand.Name == "predict" { + if arguments.Auto.ExitCode || arguments.Predict.ExitCode { os.Exit(10) } } -- GitLab