Skip to content

Commit 4e81080

Browse files
fix: flush sentry events before exiting
Signed-off-by: Siddhant N Trivedi <[email protected]>
1 parent 4178196 commit 4e81080

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

cmd/deepsource/main.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package main
33
import (
44
"log"
55
"os"
6+
"time"
67

78
"github.com/deepsourcelabs/cli/command"
89
v "github.com/deepsourcelabs/cli/version"
@@ -22,7 +23,6 @@ var (
2223
)
2324

2425
func main() {
25-
2626
log.SetFlags(log.LstdFlags | log.Lshortfile)
2727

2828
// Init sentry
@@ -38,6 +38,7 @@ func main() {
3838
// TODO: Handle exit codes here
3939
pterm.Error.Println(err)
4040
sentry.CaptureException(err)
41+
sentry.Flush(2 * time.Second)
4142
os.Exit(1)
4243
}
4344
}

command/report/report.go

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"io/ioutil"
88
"os"
99
"strings"
10+
"time"
1011

1112
"github.com/deepsourcelabs/cli/utils"
1213
"github.com/getsentry/sentry-go"
@@ -30,6 +31,7 @@ func NewCmdReport() *cobra.Command {
3031
Args: utils.NoArgs,
3132
Run: func(cmd *cobra.Command, args []string) {
3233
returnCode := opts.Run()
34+
sentry.Flush(2 * time.Second)
3335
defer os.Exit(returnCode)
3436
},
3537
}

0 commit comments

Comments
 (0)