mirror of
https://github.com/kevin-DL/revel-cmd.git
synced 2026-01-11 18:54:31 +00:00
Added message for debugging
Added process state message to be returned to wait channel to help resolve the reason for the "app died" message
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user