hook output and err are written to gh-ost's stderr
This commit is contained in:
parent
676020000a
commit
ef386add5c
@ -65,14 +65,14 @@ func (this *HooksExecutor) applyEnvironmentVairables(extraVariables ...string) [
|
|||||||
}
|
}
|
||||||
|
|
||||||
// executeHook executes a command, and sets relevant environment variables
|
// 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 {
|
func (this *HooksExecutor) executeHook(hook string, extraVariables ...string) error {
|
||||||
cmd := exec.Command(hook)
|
cmd := exec.Command(hook)
|
||||||
cmd.Env = this.applyEnvironmentVairables(extraVariables...)
|
cmd.Env = this.applyEnvironmentVairables(extraVariables...)
|
||||||
|
|
||||||
if err := cmd.Run(); err != nil {
|
combinedOutput, err := cmd.CombinedOutput()
|
||||||
return log.Errore(err)
|
fmt.Fprintln(os.Stderr, string(combinedOutput))
|
||||||
}
|
return log.Errore(err)
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *HooksExecutor) detectHooks(baseName string) (hooks []string, err error) {
|
func (this *HooksExecutor) detectHooks(baseName string) (hooks []string, err error) {
|
||||||
|
@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
# Sample hook file for gh-ost-on-success
|
# 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"
|
||||||
|
Loading…
Reference in New Issue
Block a user