Skip to content

Commit 26b7860

Browse files
author
Shuo
authored
Merge pull request #541 from openset/develop
Update: CheckErr
2 parents e3b7517 + a7af1ab commit 26b7860

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

internal/base/base.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"encoding/json"
66
"fmt"
77
"io/ioutil"
8+
"log"
89
"os"
910
"path"
1011
"path/filepath"
@@ -53,8 +54,7 @@ func Usage() {
5354
fmt.Printf("\t%-11s \t%s\n", cmd.Name(), cmd.Short)
5455
}
5556
}
56-
fmt.Printf("\nUse \"%s help <command>\" for more information about a command.", CmdName)
57-
fmt.Println()
57+
fmt.Printf("\nUse \"%s help <command>\" for more information about a command.\n", CmdName)
5858
Exit()
5959
}
6060

@@ -92,13 +92,12 @@ func getFilePath(filename string) string {
9292

9393
func CheckErr(err error) {
9494
if err != nil {
95-
fmt.Println(err.Error())
96-
Exit()
95+
log.Fatalln(err)
9796
}
9897
}
9998

10099
func Exit() {
101-
os.Exit(1)
100+
os.Exit(0)
102101
}
103102

104103
func AuthInfo(cmd string) string {

internal/helper/helper.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ func runHelper(cmd *base.Command, args []string) {
2222
buf.WriteString(base.AuthInfo("helper"))
2323
buf.WriteString("\n# Helper\n\n")
2424
buf.WriteString("```text\n")
25-
out, _ := exec.Command(base.CmdName).Output()
25+
out, err := exec.Command(base.CmdName).Output()
26+
base.CheckErr(err)
2627
buf.Write(out)
2728
buf.WriteString("```\n")
2829
base.FilePutContents("helper/README.md", buf.Bytes())

0 commit comments

Comments
 (0)