prompt default implementation to prevent a panic

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
Nicolas De Loof 2025-10-24 09:56:47 +02:00 committed by Guillaume Lours
parent ac3b8fd8a5
commit 3ce52883cb

View File

@ -37,6 +37,7 @@ import (
"github.com/docker/docker/api/types/volume"
"github.com/docker/docker/client"
"github.com/jonboulle/clockwork"
"github.com/sirupsen/logrus"
"github.com/docker/compose/v2/pkg/api"
)
@ -63,6 +64,13 @@ func NewComposeService(dockerCli command.Cli, options ...Option) api.Compose {
for _, option := range options {
option(s)
}
if s.prompt == nil {
s.prompt = func(message string, defaultValue bool) (bool, error) {
fmt.Println(message)
logrus.Warning("Compose is running without a 'prompt' component to interact with user")
return defaultValue, nil
}
}
return s
}