Skip to content

Commit

Permalink
Error message cleanup and Return same exit code as of orchestrated exe (
Browse files Browse the repository at this point in the history
#234)

The change addresses 2 issues:

- The error message `error generating build files` by cbuild is
redundant. `cbuild `should return the same error which are reported by
csolution covert step.
- `cbuild `should return the same exit code provided by the orchestrated
utlities.
  • Loading branch information
soumeh01 authored Jun 12, 2024
1 parent 02cc686 commit e334a0c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
9 changes: 8 additions & 1 deletion cmd/cbuild/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ package main
import (
"fmt"
"os"
"os/exec"

"github.com/Open-CMSIS-Pack/cbuild/v2/cmd/cbuild/commands"
log "github.com/sirupsen/logrus"
Expand All @@ -25,7 +26,13 @@ func main() {
err := cmd.Execute()
if err != nil {
log.Error(err)
os.Exit(-1)
if exitError, ok := err.(*exec.ExitError); ok {
os.Exit(exitError.ExitCode())
} else {
os.Exit(1)
}
} else {
os.Exit(0)
}
}

Expand Down
1 change: 0 additions & 1 deletion pkg/builder/csolution/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,6 @@ func (b CSolutionBuilder) Build() (err error) {

// STEP 2: Generate build file(s)
if err = b.generateBuildFiles(); err != nil {
log.Error("error generating build files")
return err
}

Expand Down

0 comments on commit e334a0c

Please sign in to comment.