Significant improvements to attaching/console handling

This commit is contained in:
Dane Everitt
2019-04-20 16:20:08 -07:00
parent ebe98aa860
commit 870adffc14
6 changed files with 181 additions and 23 deletions

View File

@@ -67,6 +67,15 @@ func main() {
if err := s.CreateEnvironment(); err != nil {
zap.S().Errorw("failed to create an environment for server", zap.String("server", s.Uuid), zap.Error(err))
}
if r, err := s.Environment().IsRunning(); err != nil {
zap.S().Errorw("error checking server environment status", zap.String("server", s.Uuid), zap.Error(err))
} else if r {
zap.S().Infow("detected server is running, re-attaching to process", zap.String("server", s.Uuid))
if err := s.Environment().Attach(); err != nil {
zap.S().Errorw("error attaching to server environment", zap.String("server", s.Uuid), zap.Error(err))
}
}
}
r := &Router{