Fix timeout initialization when waitTimeout is zero by htoyoda18 · Pull Request #13471 · docker/compose

What I did
I updated the timeout initialization logic to only set a time.Duration value when waitTimeout is greater than zero.

Previously, the timeout was always calculated, even when waitTimeout was zero or a negative value. This could unintentionally override the default behavior or result in an invalid timeout being applied.

With this change, the timeout is now explicitly guarded:

  • The default behavior is preserved when waitTimeout is unset or zero
  • Negative values are safely ignored, preventing unintended or invalid timeout configurations

This makes the behavior more explicit and defensive.

Related issue

N/A

(not mandatory) A picture of a cute animal, if possible in relation to what you did
A small guard to prevent unintended behavior 🐶
dogs