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 7b1bcb3 + 294d24f commit 02f8fa7Copy full SHA for 02f8fa7
main.go
@@ -2,6 +2,7 @@ package main
2
3
import (
4
"fmt"
5
+ "io"
6
"os"
7
"strings"
8
@@ -129,7 +130,20 @@ func main() {
129
130
}
131
return nil
132
133
+ // If the command returns an error, cli takes upon itself to print
134
+ // the error on cli.ErrWriter and exit.
135
+ // Use our own writer here to ensure the log gets sent to the right location.
136
+ cli.ErrWriter = &FatalWriter{cli.ErrWriter}
137
if err := app.Run(os.Args); err != nil {
138
fatal(err)
139
140
141
+
142
+type FatalWriter struct {
143
+ cliErrWriter io.Writer
144
+}
145
146
+func (f *FatalWriter) Write(p []byte) (n int, err error) {
147
+ logrus.Error(string(p))
148
+ return f.cliErrWriter.Write(p)
149
0 commit comments