mirror of
https://github.com/docker/compose.git
synced 2025-04-08 17:05:13 +02:00
run watch standalone if menu fails to start
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
c23eea9341
commit
7aa64ae9cb
@ -72,8 +72,28 @@ func (s *composeService) Up(ctx context.Context, project *types.Project, options
|
||||
var isTerminated atomic.Bool
|
||||
printer := newLogPrinter(options.Start.Attach)
|
||||
|
||||
var kEvents <-chan keyboard.KeyEvent
|
||||
if options.Start.NavigationMenu {
|
||||
kEvents, err = keyboard.GetKeys(100)
|
||||
if err != nil {
|
||||
logrus.Warnf("could not start menu, an error occurred while starting: %v", err)
|
||||
options.Start.NavigationMenu = false
|
||||
} else {
|
||||
defer keyboard.Close() //nolint:errcheck
|
||||
isWatchConfigured := s.shouldWatch(project)
|
||||
isDockerDesktopActive := s.isDesktopIntegrationActive()
|
||||
tracing.KeyboardMetrics(ctx, options.Start.NavigationMenu, isDockerDesktopActive, isWatchConfigured)
|
||||
formatter.NewKeyboardManager(ctx, isDockerDesktopActive, isWatchConfigured, signalChan, s.watch)
|
||||
}
|
||||
}
|
||||
|
||||
doneCh := make(chan bool)
|
||||
eg.Go(func() error {
|
||||
if options.Start.NavigationMenu && options.Start.Watch {
|
||||
// Run watch by navigation menu, so we can interactively enable/disable
|
||||
formatter.KeyboardManager.StartWatch(ctx, doneCh, project, options)
|
||||
}
|
||||
|
||||
first := true
|
||||
gracefulTeardown := func() {
|
||||
printer.Cancel()
|
||||
@ -89,24 +109,6 @@ func (s *composeService) Up(ctx context.Context, project *types.Project, options
|
||||
first = false
|
||||
}
|
||||
|
||||
var kEvents <-chan keyboard.KeyEvent
|
||||
if options.Start.NavigationMenu {
|
||||
kEvents, err = keyboard.GetKeys(100)
|
||||
if err != nil {
|
||||
logrus.Warn("could not start menu, an error occurred while starting.")
|
||||
} else {
|
||||
defer keyboard.Close() //nolint:errcheck
|
||||
isWatchConfigured := s.shouldWatch(project)
|
||||
isDockerDesktopActive := s.isDesktopIntegrationActive()
|
||||
tracing.KeyboardMetrics(ctx, options.Start.NavigationMenu, isDockerDesktopActive, isWatchConfigured)
|
||||
|
||||
formatter.NewKeyboardManager(ctx, isDockerDesktopActive, isWatchConfigured, signalChan, s.watch)
|
||||
if options.Start.Watch {
|
||||
formatter.KeyboardManager.StartWatch(ctx, doneCh, project, options)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-doneCh:
|
||||
|
Loading…
x
Reference in New Issue
Block a user