Skip to content

Commit

Permalink
Improve exec hook output, fixes ddev#1818, fixes ddev#1765
Browse files Browse the repository at this point in the history
* Show output of hook task whether or not it fails (ddev#1818)
* Don't show a bunch of docker-compose nonsense
* Add a warning explaining that this is configuration that failed (ddev#1765)
* Allow interactive commands in hook
  • Loading branch information
rfay committed Oct 2, 2019
1 parent 96a4a90 commit e4f3ec5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/ddevapp/ddevapp.go
Expand Up @@ -666,10 +666,12 @@ func (app *DdevApp) ProcessHooks(hookName string) error {
output.UserOut.Printf("=== Running task: %s, output below", a.GetDescription())

stdout, stderr, err := a.Execute()
//output.UserOut.Println(stdout + "\n" + stderr)

if err != nil {
return fmt.Errorf("task failed: %v", err)
output.UserOut.Errorf("task failed: %v: %s %s", a.GetDescription(), stdout, stderr)
output.UserOut.Warn("A task failure does not mean that ddev failed, but your hook configuration has a command that failed.")
}
output.UserOut.Println(stdout + "\n" + stderr)
}

return nil
Expand Down
1 change: 1 addition & 0 deletions pkg/ddevapp/task.go
Expand Up @@ -42,6 +42,7 @@ func (c ExecTask) Execute() (string, string, error) {
stdout, stderr, err := c.app.Exec(&ExecOpts{
Service: c.service,
Cmd: c.exec,
Tty: true,
})

return stdout, stderr, err
Expand Down

0 comments on commit e4f3ec5

Please sign in to comment.