From bf1bd3fc60e55b6356bc4e85009255a05bb34fec Mon Sep 17 00:00:00 2001 From: Guillaume Lours <705411+glours@users.noreply.github.com> Date: Fri, 7 Jun 2024 13:45:31 +0200 Subject: [PATCH] return an error when --detach and --watch are used together in up command Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com> --- cmd/compose/up.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/compose/up.go b/cmd/compose/up.go index 5e21f9f56..9e94d3736 100644 --- a/cmd/compose/up.go +++ b/cmd/compose/up.go @@ -186,8 +186,8 @@ func validateFlags(up *upOptions, create *createOptions) error { if create.Build && create.noBuild { return fmt.Errorf("--build and --no-build are incompatible") } - if up.Detach && (up.attachDependencies || up.cascadeStop || up.cascadeFail || len(up.attach) > 0) { - return fmt.Errorf("--detach cannot be combined with --abort-on-container-exit, --abort-on-container-failure, --attach or --attach-dependencies") + 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 create.forceRecreate && create.noRecreate { return fmt.Errorf("--force-recreate and --no-recreate are incompatible")