From ed384801c6001f91209a62281471381b61268b06 Mon Sep 17 00:00:00 2001 From: zztaki Date: Fri, 24 Nov 2023 01:48:18 -0700 Subject: [PATCH] Fix (target start): curveadm target start timeout Signed-off-by: zztaki --- internal/task/step/container.go | 4 ++++ internal/task/task/bs/start_tgtd.go | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/task/step/container.go b/internal/task/step/container.go index 0ddd41a1f..61ba9ae18 100644 --- a/internal/task/step/container.go +++ b/internal/task/step/container.go @@ -119,6 +119,7 @@ type ( ContainerExec struct { ContainerId *string Command string + Detached bool Success *bool Out *string module.ExecOptions @@ -289,6 +290,9 @@ func (s *ListContainers) Execute(ctx *context.Context) error { func (s *ContainerExec) Execute(ctx *context.Context) error { cli := ctx.Module().DockerCli().ContainerExec(*s.ContainerId, s.Command) + if s.Detached { + cli.AddOption("--detach") + } out, err := cli.Execute(s.ExecOptions) return PostHandle(s.Success, s.Out, out, err, errno.ERR_RUN_COMMAND_IN_CONTAINER_FAILED.FD("(%s exec CONTAINER COMMAND)", s.ExecWithEngine)) } diff --git a/internal/task/task/bs/start_tgtd.go b/internal/task/task/bs/start_tgtd.go index fbd9ca462..0c2234405 100644 --- a/internal/task/task/bs/start_tgtd.go +++ b/internal/task/task/bs/start_tgtd.go @@ -127,7 +127,8 @@ func NewStartTargetDaemonTask(curveadm *cli.CurveAdm, cc *configure.ClientConfig ExecOptions: curveadm.ExecOptions(), }) t.AddStep(&step.ContainerExec{ - Command: "tgtd -f &", + Command: "tgtd -f", + Detached: true, ContainerId: &containerId, ExecOptions: curveadm.ExecOptions(), })