diff --git a/container/container_init.go b/container/container_init.go index a5985cd..39e9560 100644 --- a/container/container_init.go +++ b/container/container_init.go @@ -16,7 +16,7 @@ import ( "github.com/opencontainers/runtime-spec/specs-go" ) -func (c *Container) Init(reexec string, arg string) error { +func (c *Container) Init(reexecCmd string, reexecArgs []string) error { if err := c.ExecHooks("createRuntime"); err != nil { return fmt.Errorf("execute createRuntime hooks: %w", err) } @@ -25,7 +25,7 @@ func (c *Container) Init(reexec string, arg string) error { return fmt.Errorf("execute createContainer hooks: %w", err) } - cmd := exec.Command(reexec, []string{arg, c.ID()}...) + cmd := exec.Command(reexecCmd, append(reexecArgs, c.ID())...) useTerminal := c.Spec.Process != nil && c.Spec.Process.Terminal && diff --git a/internal/cli/cli.go b/internal/cli/cli.go index db0359e..762d4b1 100644 --- a/internal/cli/cli.go +++ b/internal/cli/cli.go @@ -76,7 +76,7 @@ func createCmd() *cobra.Command { ConsoleSocket: consoleSocket, PIDFile: pidFile, ReexecCmd: "/proc/self/exe", - ReexecSubcmd: "reexec", + ReexecArgs: []string{"reexec"}, }) }, } diff --git a/internal/commands/create.go b/internal/commands/create.go index 153c0b3..2d3f2ff 100644 --- a/internal/commands/create.go +++ b/internal/commands/create.go @@ -16,7 +16,7 @@ type CreateOpts struct { ConsoleSocket string PIDFile string ReexecCmd string - ReexecSubcmd string + ReexecArgs []string } func Create(opts *CreateOpts) error { @@ -44,5 +44,5 @@ func Create(opts *CreateOpts) error { return fmt.Errorf("create container: %w", err) } - return cntr.Init(opts.ReexecCmd, opts.ReexecSubcmd) + return cntr.Init(opts.ReexecCmd, opts.ReexecArgs) }