Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion cmd/urunc/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,18 @@ func startUnikontainer(cmd *cli.Command) error {
return err
}

return unikontainer.ExecuteHooks("Poststart")
if err := unikontainer.ExecuteHooks("Poststart"); err != nil {
// The spec requires a failing poststart hook to stop the container and
// continue with the delete transition (runtime.md, lifecycle step 9).
// The monitor keeps the guest alive otherwise, and a plain delete
// refuses while the container's init process still runs.
if killErr := unikontainer.Kill(); killErr != nil {
return errors.Join(err, fmt.Errorf("failed to stop the container after a failing poststart hook: %w", killErr))
}
return err
}

return nil
}

// startMonitorInit starts the urunc monitor process, blocked since create from
Expand Down