Skip to content

Commit 9a9a7ca

Browse files
committed
#39 Added error handling on execution step
1 parent 09ca017 commit 9a9a7ca

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

execute.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,12 @@ func execute(name string, arg ...string) error {
1919
cmd.Stdout = os.Stdout
2020
cmd.Stderr = os.Stderr
2121
cmd.Stdin = os.Stdin
22+
res := cmd.Run()
2223

23-
return cmd.Run()
24+
if res != nil {
25+
os.Exit(ExecuteFailed)
26+
}
27+
return res
2428
}
2529

2630
func oneliner(name string, arg ...string) (string, error) {

exitstatus.go

+3
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,7 @@ const (
3030

3131
// DeleteImageFailed represents failure during image deletion
3232
DeleteImageFailed = 11
33+
34+
// ExecuteFailed represents an execution failure
35+
ExecuteFailed = 12
3336
)

0 commit comments

Comments
 (0)