Skip to content

Commit

Permalink
Added message for debugging
Browse files Browse the repository at this point in the history
Added process state message to be returned to wait channel to help resolve the reason for the "app died" message
  • Loading branch information
notzippy committed Sep 19, 2018
1 parent 17459d1 commit c47f447
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
20 changes: 13 additions & 7 deletions harness/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -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
}
Expand Down
1 change: 1 addition & 0 deletions harness/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit c47f447

Please sign in to comment.