Skip to content

Commit

Permalink
Merge branch 'opencurve:develop' into cli-doc
Browse files Browse the repository at this point in the history
  • Loading branch information
hdbdn77 authored Nov 24, 2023
2 parents 0829253 + 9d83a9c commit c298439
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions internal/task/step/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ type (
ContainerExec struct {
ContainerId *string
Command string
Detached bool
Success *bool
Out *string
module.ExecOptions
Expand Down Expand Up @@ -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))
}
Expand Down
3 changes: 2 additions & 1 deletion internal/task/task/bs/start_tgtd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
})
Expand Down

0 comments on commit c298439

Please sign in to comment.