From b27f56eb19888e187096351401f0a5950e0417f1 Mon Sep 17 00:00:00 2001 From: Nicolas De Loof Date: Fri, 21 Feb 2025 09:39:16 +0100 Subject: [PATCH] fix error message when detach is implied by wait Signed-off-by: Nicolas De Loof --- cmd/compose/up.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/compose/up.go b/cmd/compose/up.go index e41a9549b..913f26b01 100644 --- a/cmd/compose/up.go +++ b/cmd/compose/up.go @@ -193,7 +193,11 @@ func validateFlags(up *upOptions, create *createOptions) error { return fmt.Errorf("--build and --no-build are incompatible") } if up.Detach && (up.attachDependencies || up.cascadeStop || up.cascadeFail || len(up.attach) > 0 || up.watch) { - return fmt.Errorf("--detach cannot be combined with --abort-on-container-exit, --abort-on-container-failure, --attach, --attach-dependencies or --watch") + if up.wait { + return fmt.Errorf("--wait cannot be combined with --abort-on-container-exit, --abort-on-container-failure, --attach, --attach-dependencies or --watch") + } else { + return fmt.Errorf("--detach cannot be combined with --abort-on-container-exit, --abort-on-container-failure, --attach, --attach-dependencies or --watch") + } } if create.noInherit && create.noRecreate { return fmt.Errorf("--no-recreate and --renew-anon-volumes are incompatible")