diff --git a/go/logic/hooks.go b/go/logic/hooks.go index ea1fa11..8906f62 100644 --- a/go/logic/hooks.go +++ b/go/logic/hooks.go @@ -65,14 +65,14 @@ func (this *HooksExecutor) applyEnvironmentVairables(extraVariables ...string) [ } // executeHook executes a command, and sets relevant environment variables +// combined output & error are printed to gh-ost's standard error. func (this *HooksExecutor) executeHook(hook string, extraVariables ...string) error { cmd := exec.Command(hook) cmd.Env = this.applyEnvironmentVairables(extraVariables...) - if err := cmd.Run(); err != nil { - return log.Errore(err) - } - return nil + combinedOutput, err := cmd.CombinedOutput() + fmt.Fprintln(os.Stderr, string(combinedOutput)) + return log.Errore(err) } func (this *HooksExecutor) detectHooks(baseName string) (hooks []string, err error) { diff --git a/resources/hooks-sample/gh-ost-on-success-hook-2 b/resources/hooks-sample/gh-ost-on-success-hook-2 index aa4aedc..29cba49 100755 --- a/resources/hooks-sample/gh-ost-on-success-hook-2 +++ b/resources/hooks-sample/gh-ost-on-success-hook-2 @@ -2,4 +2,4 @@ # Sample hook file for gh-ost-on-success -echo "$(date) gh-ost-on-success $GH_OST_DATABASE_NAME.$GH_OST_TABLE_NAME" >> /tmp/gh-ost.log +echo "$(date) gh-ost-on-success $GH_OST_DATABASE_NAME.$GH_OST_TABLE_NAME -- this message should show on the gh-ost log"