Skip to content

Commit 5fc13e2

Browse files
committed
Clean up error handling
1 parent f697308 commit 5fc13e2

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

runny/cmd.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ func Run() {
2929
// read command line args
3030
if len(args) > 0 {
3131
name := CommandName(args[0])
32-
runny.Execute(name, args[1:]...)
32+
err := runny.Execute(name, args[1:]...)
33+
if err != nil {
34+
errorColor.Println(err)
35+
os.Exit(1)
36+
}
3337
} else {
3438
runny.PrintCommands()
3539
}

runny/model.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ func (c *Config) Execute(name CommandName, args ...string) error {
111111
for _, name := range command.Needs {
112112
err := c.Execute(name)
113113
if err != nil {
114+
errorColor.Print(err)
114115
return err
115116
}
116117
}
@@ -131,7 +132,6 @@ func (c *Config) Execute(name CommandName, args ...string) error {
131132
if len(run) > 0 {
132133
err := shell.Run(run, args, true, c.verbose, env)
133134
if err != nil {
134-
fmt.Printf("%s %s\n", color.RedString(string(run)), secondaryColor.Sprint(err))
135135
return err
136136
}
137137
}

0 commit comments

Comments
 (0)