Skip to content

Commit 90e0930

Browse files
Merge branch 'main' of https://github.com/Checkmarx/ast-cli into feature/AST-111326
2 parents 52f4ed6 + 7cd7bdb commit 90e0930

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

cmd/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,10 @@ func exitIfError(err error) {
146146
if err != nil {
147147
switch e := err.(type) {
148148
case *wrappers.AstError:
149-
fmt.Println(e.Err)
149+
fmt.Fprintln(os.Stderr, e.Err)
150150
os.Exit(e.Code)
151151
default:
152-
fmt.Println(e)
152+
fmt.Fprintln(os.Stderr, e)
153153
os.Exit(failureExitCode)
154154
}
155155
}

internal/commands/root.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,8 @@ func NewAstCLI(
248248
)
249249

250250
rootCmd.SilenceUsage = true
251+
// Avoid Cobra printing the error in addition to our own handling in main
252+
rootCmd.SilenceErrors = true
251253
return rootCmd
252254
}
253255

0 commit comments

Comments
 (0)