Skip to content

Commit

Permalink
slack error message fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
razzkumar committed Sep 23, 2019
1 parent 842b584 commit d58c095
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions deployment/utils/shell/shell.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package shell

import (
"bytes"
"errors"
"fmt"
"os"
"os/exec"
)
Expand All @@ -9,10 +12,19 @@ import (
func Execute(command string) error {
cmd := exec.Command("bash", "-c", command)

var out bytes.Buffer
var stderr bytes.Buffer

cmd.Stderr = &stderr
cmd.Stdout = &out

cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr

err := cmd.Run()

return err
if err != nil {
return errors.New(fmt.Sprint(err) + ":- " + stderr.String())
}

return nil
}

0 comments on commit d58c095

Please sign in to comment.