We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 6408e9e + 4b8b811 commit 7cd7bdbCopy full SHA for 7cd7bdb
cmd/main.go
@@ -146,10 +146,10 @@ func exitIfError(err error) {
146
if err != nil {
147
switch e := err.(type) {
148
case *wrappers.AstError:
149
- fmt.Println(e.Err)
+ fmt.Fprintln(os.Stderr, e.Err)
150
os.Exit(e.Code)
151
default:
152
- fmt.Println(e)
+ fmt.Fprintln(os.Stderr, e)
153
os.Exit(failureExitCode)
154
}
155
internal/commands/root.go
@@ -242,6 +242,8 @@ func NewAstCLI(
242
)
243
244
rootCmd.SilenceUsage = true
245
+ // Avoid Cobra printing the error in addition to our own handling in main
246
+ rootCmd.SilenceErrors = true
247
return rootCmd
248
249
0 commit comments