mirror of
https://github.com/Jguer/yay.git
synced 2025-12-27 10:01:53 -05:00
chore(yay): avoid clearing panics in the main func (#1801)
This commit is contained in:
21
main.go
21
main.go
@@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"runtime/debug"
|
||||
|
||||
pacmanconf "github.com/Morganamilo/go-pacmanconf"
|
||||
"github.com/leonelquinteros/gotext"
|
||||
@@ -95,7 +96,14 @@ func main() {
|
||||
ret = 0
|
||||
)
|
||||
|
||||
defer func() { os.Exit(ret) }()
|
||||
defer func() {
|
||||
if rec := recover(); rec != nil {
|
||||
text.Errorln(rec)
|
||||
debug.PrintStack()
|
||||
}
|
||||
|
||||
os.Exit(ret)
|
||||
}()
|
||||
|
||||
initGotext()
|
||||
|
||||
@@ -173,7 +181,14 @@ func main() {
|
||||
return
|
||||
}
|
||||
|
||||
defer dbExecutor.Cleanup()
|
||||
defer func() {
|
||||
if rec := recover(); rec != nil {
|
||||
text.Errorln(rec)
|
||||
debug.PrintStack()
|
||||
}
|
||||
|
||||
dbExecutor.Cleanup()
|
||||
}()
|
||||
|
||||
if err = handleCmd(ctx, cmdArgs, db.Executor(dbExecutor)); err != nil {
|
||||
if str := err.Error(); str != "" {
|
||||
@@ -188,7 +203,5 @@ func main() {
|
||||
|
||||
// fallback
|
||||
ret = 1
|
||||
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user