Skip to content

Commit

Permalink
feat: generalise the fork
Browse files Browse the repository at this point in the history
  • Loading branch information
nixpig committed Oct 31, 2024
1 parent d2c4561 commit f94a9a0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions container/container_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"github.com/opencontainers/runtime-spec/specs-go"
)

func (c *Container) Init() error {
func (c *Container) Init(exe string, arg string) error {
if err := c.ExecHooks("createRuntime"); err != nil {
return fmt.Errorf("execute createruntime hooks: %w", err)
}
Expand Down Expand Up @@ -49,9 +49,9 @@ func (c *Container) Init() error {
}

c.forkCmd = exec.Command(
"/proc/self/exe",
exe,
[]string{
"fork",
arg,
c.State.ID,
}...)

Expand Down
2 changes: 1 addition & 1 deletion internal/commands/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,5 @@ func Create(opts *CreateOpts, log *zerolog.Logger, db *sql.DB) error {
return fmt.Errorf("insert into db: %w", err)
}

return cntr.Init()
return cntr.Init("/proc/self/exe", "fork")
}

0 comments on commit f94a9a0

Please sign in to comment.