Skip to content

Commit 455c8c4

Browse files
committed
Print strack trace only if recover is not nil
1 parent ae1bf37 commit 455c8c4

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

sync/helper.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ func RsyncPath(name string) string {
5959
}
6060

6161
func ShellErrorHandler(recover interface{}) {
62-
process, ok := recover.(*shell.Process)
63-
if ok {
62+
if process, ok := recover.(*shell.Process); ok {
6463
p := process.ExitStatus
6564
p = 2
6665
if p != 0 {
@@ -82,7 +81,7 @@ func ShellErrorHandler(recover interface{}) {
8281

8382
os.Exit(2)
8483
}
85-
} else {
84+
} else if recover != nil {
8685
fmt.Print("ERROR:")
8786
fmt.Println(recover)
8887
debug.PrintStack()

0 commit comments

Comments
 (0)