Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
admpub committed Sep 7, 2023
1 parent f9c084e commit e1840d7
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"log"
"os"
"runtime"
"strings"
"time"
)

Expand All @@ -18,6 +19,9 @@ const (
// ExitOnSuccess 成功时退出程序
func ExitOnSuccess(msg string) {
os.Stdout.WriteString(msg)
if !strings.HasSuffix(msg, StrLF) {
os.Stdout.WriteString(StrLF)
}
os.Exit(0)
}

Expand All @@ -28,6 +32,9 @@ func ExitOnFailure(msg string, errCodes ...int) {
errCode = errCodes[0]
}
os.Stderr.WriteString(msg)
if !strings.HasSuffix(msg, StrLF) {
os.Stdout.WriteString(StrLF)
}
os.Exit(errCode)
}

Expand Down

0 comments on commit e1840d7

Please sign in to comment.