fix: avoid setting timeout when waitTimeout is not positive

Signed-off-by: hiroto.toyoda <hiroto.toyoda@dena.com>
This commit is contained in:
hiroto.toyoda
2025-12-20 15:46:39 +09:00
committed by Nicolas De loof
parent ee4c01b66b
commit d95aa57f01
2 changed files with 11 additions and 2 deletions

View File

@@ -63,7 +63,10 @@ func runStart(ctx context.Context, dockerCli command.Cli, backendOptions *Backen
return err
}
timeout := time.Duration(opts.waitTimeout) * time.Second
var timeout time.Duration
if opts.waitTimeout > 0 {
timeout = time.Duration(opts.waitTimeout) * time.Second
}
return backend.Start(ctx, name, api.StartOptions{
AttachTo: services,
Project: project,

View File

@@ -188,6 +188,9 @@ func upCommand(p *ProjectOptions, dockerCli command.Cli, backendOptions *Backend
//nolint:gocyclo
func validateFlags(up *upOptions, create *createOptions) error {
if up.waitTimeout < 0 {
return fmt.Errorf("--wait-timeout must be a non-negative integer")
}
if up.exitCodeFrom != "" && !up.cascadeFail {
up.cascadeStop = true
}
@@ -328,7 +331,10 @@ func runUp(
attach = attachSet.Elements()
}
timeout := time.Duration(upOptions.waitTimeout) * time.Second
var timeout time.Duration
if upOptions.waitTimeout > 0 {
timeout = time.Duration(upOptions.waitTimeout) * time.Second
}
return backend.Up(ctx, project, api.UpOptions{
Create: create,
Start: api.StartOptions{