Skip to content

Commit 723ab8c

Browse files
committed
Merge branch 'command-with-error' into 'master'
Fix for #29 See merge request centerorbit/depcharge!38
2 parents 55ef1cb + 9886d31 commit 723ab8c

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

actions.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ func defaultAction(complete chan<- bool, dep Dep, perform Perform) {
1717
fmt.Println("Dry run of: `", perform.Kind, strings.Join(mustachedActionParams, " "), "` for: ", dep.Location)
1818
} else {
1919
fmt.Println("Running: `", perform.Kind, strings.Join(mustachedActionParams, " "), "` for: ", dep.Location)
20-
20+
command := perform.Kind + " " + strings.Join(mustachedActionParams, " ")
2121
cmd := exec.Command(perform.Kind, mustachedActionParams...)
2222
cmd.Dir = dep.Location
2323
//TODO: Find a way to "stream" output to terminal?
24-
checkOkay(cmd.CombinedOutput()) //Combines errors to output
24+
out, err := cmd.CombinedOutput()
25+
checkOkay(command, out, err) //Combines errors to output
2526
//out, err := cmd.Output() // just stdout
2627
}
2728

@@ -40,19 +41,22 @@ func dockerComposeAction(complete chan<- bool, perform Perform, action []string)
4041
fmt.Println("Dry run of: ")
4142
fmt.Println(perform.Kind, action)
4243
} else {
44+
command := perform.Kind + " " + strings.Join(action, " ")
4345
cmd := exec.Command(perform.Kind, action...)
4446
//TODO: Find a way to "stream" output to terminal?
45-
checkOkay(cmd.CombinedOutput()) //Combines errors to output
47+
out, err := cmd.CombinedOutput()
48+
checkOkay(command, out, err) //Combines errors to output
4649
}
4750

4851
complete <- true
4952
}
5053

5154
/// *** Helpers *** ///
5255

53-
func checkOkay(out []byte, err error) {
56+
func checkOkay(command string, out []byte, err error) {
5457
if err != nil {
5558
fmt.Println("Command finished with error: ", err)
59+
fmt.Println(command)
5660
}
5761

5862
if string(out) == "" {

0 commit comments

Comments
 (0)