From c47f44762a3a4da290edb1760da16ebe05b697d0 Mon Sep 17 00:00:00 2001 From: NotZippy Date: Wed, 19 Sep 2018 14:43:15 -0700 Subject: [PATCH] Added message for debugging Added process state message to be returned to wait channel to help resolve the reason for the "app died" message --- harness/app.go | 20 +++++++++++++------- harness/build.go | 1 + 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/harness/app.go b/harness/app.go index 1bab46cf..81262e6a 100644 --- a/harness/app.go +++ b/harness/app.go @@ -69,11 +69,11 @@ func (cmd AppCmd) Start(c *model.CommandConfig) error { } select { - case <-cmd.waitChan(): - return errors.New("revel/harness: app died") + case exitState := <-cmd.waitChan(): + return errors.New("revel/harness: app died reason: " + exitState) - case <-time.After(30 * time.Second): - log.Println("Killing revel server process did not respond after wait timeout", "processid", cmd.Process.Pid) + case <-time.After(60 * time.Second): + log.Println("Killing revel server process did not respond after wait timeout.", "processid", cmd.Process.Pid) cmd.Kill() return errors.New("revel/harness: app timed out") @@ -105,11 +105,17 @@ func (cmd AppCmd) Kill() { } // Return a channel that is notified when Wait() returns. -func (cmd AppCmd) waitChan() <-chan struct{} { - ch := make(chan struct{}, 1) +func (cmd AppCmd) waitChan() <-chan string { + ch := make(chan string, 1) go func() { _ = cmd.Wait() - ch <- struct{}{} + state := cmd.ProcessState + exitStatus := " unknown " + if state!=nil { + exitStatus = state.String() + } + + ch <- exitStatus }() return ch } diff --git a/harness/build.go b/harness/build.go index dc23e1ee..2b94a887 100644 --- a/harness/build.go +++ b/harness/build.go @@ -196,6 +196,7 @@ func Build(c *model.CommandConfig, paths *model.RevelContainer) (app *App, compi // If the build succeeded, we're done. if err == nil { + utils.Logger.Info("Build successful continuing") return NewApp(binName, paths), nil }