mirror of
https://github.com/containers/podman.git
synced 2025-08-06 11:32:07 +08:00
podman: new option --preserve-fd
add a new option --preserve-fd that allows to specify a list of FDs to pass down to the container. It is similar to --preserve-fds but it allows to specify a list of FDs instead of the maximum FD number to preserve. --preserve-fd and --preserve-fds are mutually exclusive. It requires crun since runc would complain if any fd below --preserve-fds is not preserved. Closes: https://github.com/containers/podman/issues/20844 Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
@ -66,6 +66,9 @@ type ExecConfig struct {
|
||||
// given is the number that will be passed into the exec session,
|
||||
// starting at 3.
|
||||
PreserveFDs uint `json:"preserveFds,omitempty"`
|
||||
// PreserveFD is a list of additional file descriptors (in addition
|
||||
// to 0, 1, 2) that will be passed to the executed process.
|
||||
PreserveFD []uint `json:"preserveFd,omitempty"`
|
||||
// ExitCommand is the exec session's exit command.
|
||||
// This command will be executed when the exec session exits.
|
||||
// If unset, no command will be executed.
|
||||
@ -1092,6 +1095,7 @@ func prepareForExec(c *Container, session *ExecSession) (*ExecOptions, error) {
|
||||
opts.Cwd = session.Config.WorkDir
|
||||
opts.User = session.Config.User
|
||||
opts.PreserveFDs = session.Config.PreserveFDs
|
||||
opts.PreserveFD = session.Config.PreserveFD
|
||||
opts.DetachKeys = session.Config.DetachKeys
|
||||
opts.ExitCommand = session.Config.ExitCommand
|
||||
opts.ExitCommandDelay = session.Config.ExitCommandDelay
|
||||
|
Reference in New Issue
Block a user