mirror of
https://github.com/docker/compose.git
synced 2025-07-25 14:44:29 +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
|
var isTerminated atomic.Bool
|
||||||
printer := newLogPrinter(options.Start.Attach)
|
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)
|
doneCh := make(chan bool)
|
||||||
eg.Go(func() error {
|
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
|
first := true
|
||||||
gracefulTeardown := func() {
|
gracefulTeardown := func() {
|
||||||
printer.Cancel()
|
printer.Cancel()
|
||||||
@ -89,24 +109,6 @@ func (s *composeService) Up(ctx context.Context, project *types.Project, options
|
|||||||
first = false
|
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 {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-doneCh:
|
case <-doneCh:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user