diff options
author | Brent Baude <bbaude@redhat.com> | 2020-04-16 12:25:26 -0500 |
---|---|---|
committer | Brent Baude <bbaude@redhat.com> | 2020-04-16 15:53:58 -0500 |
commit | 241326a9a8c20ad7f2bcf651416b836e7778e090 (patch) | |
tree | 4001e8e47a022bb1b9bfbf2332c42e1aeb802f9e /cmd/podman/exec.go | |
parent | 88c6fd06cd54fb9a8826306dfdf1a77e400de5de (diff) | |
download | podman-241326a9a8c20ad7f2bcf651416b836e7778e090.tar.gz podman-241326a9a8c20ad7f2bcf651416b836e7778e090.tar.bz2 podman-241326a9a8c20ad7f2bcf651416b836e7778e090.zip |
Podman V2 birth
remote podman v1 and replace with podman v2.
Signed-off-by: Brent Baude <bbaude@redhat.com>
Diffstat (limited to 'cmd/podman/exec.go')
-rw-r--r-- | cmd/podman/exec.go | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/cmd/podman/exec.go b/cmd/podman/exec.go deleted file mode 100644 index b341ab496..000000000 --- a/cmd/podman/exec.go +++ /dev/null @@ -1,75 +0,0 @@ -package main - -import ( - "github.com/containers/libpod/cmd/podman/cliconfig" - "github.com/containers/libpod/pkg/adapter" - "github.com/pkg/errors" - "github.com/spf13/cobra" -) - -var ( - execCommand cliconfig.ExecValues - - execDescription = `Execute the specified command inside a running container. -` - _execCommand = &cobra.Command{ - Use: "exec [flags] CONTAINER [COMMAND [ARG...]]", - Short: "Run a process in a running container", - Long: execDescription, - RunE: func(cmd *cobra.Command, args []string) error { - execCommand.InputArgs = args - execCommand.GlobalFlags = MainGlobalOpts - execCommand.Remote = remoteclient - return execCmd(&execCommand) - }, - Example: `podman exec -it ctrID ls - podman exec -it -w /tmp myCtr pwd - podman exec --user root ctrID ls`, - } -) - -func init() { - execCommand.Command = _execCommand - execCommand.SetHelpTemplate(HelpTemplate()) - execCommand.SetUsageTemplate(UsageTemplate()) - flags := execCommand.Flags() - flags.SetInterspersed(false) - flags.StringVar(&execCommand.DetachKeys, "detach-keys", getDefaultDetachKeys(), "Select the key sequence for detaching a container. Format is a single character [a-Z] or ctrl-<value> where <value> is one of: a-z, @, ^, [, , or _") - flags.StringArrayVarP(&execCommand.Env, "env", "e", []string{}, "Set environment variables") - flags.StringSliceVar(&execCommand.EnvFile, "env-file", []string{}, "Read in a file of environment variables") - flags.BoolVarP(&execCommand.Interactive, "interactive", "i", false, "Keep STDIN open even if not attached") - flags.BoolVarP(&execCommand.Latest, "latest", "l", false, "Act on the latest container podman is aware of") - flags.BoolVar(&execCommand.Privileged, "privileged", false, "Give the process extended Linux capabilities inside the container. The default is false") - flags.BoolVarP(&execCommand.Tty, "tty", "t", false, "Allocate a pseudo-TTY. The default is false") - flags.StringVarP(&execCommand.User, "user", "u", "", "Sets the username or UID used and optionally the groupname or GID for the specified command") - - flags.IntVar(&execCommand.PreserveFDs, "preserve-fds", 0, "Pass N additional file descriptors to the container") - flags.StringVarP(&execCommand.Workdir, "workdir", "w", "", "Working directory inside the container") - markFlagHiddenForRemoteClient("env-file", flags) - markFlagHiddenForRemoteClient("latest", flags) - markFlagHiddenForRemoteClient("preserve-fds", flags) -} - -func execCmd(c *cliconfig.ExecValues) error { - argLen := len(c.InputArgs) - if c.Latest { - if argLen < 1 { - return errors.Errorf("you must provide a command to exec") - } - } else { - if argLen < 1 { - return errors.Errorf("you must provide one container name or id") - } - if argLen < 2 { - return errors.Errorf("you must provide a command to exec") - } - } - runtime, err := adapter.GetRuntimeNoStore(getContext(), &c.PodmanCommand) - if err != nil { - return errors.Wrapf(err, "error creating libpod runtime") - } - defer runtime.DeferredShutdown(false) - - exitCode, err = runtime.ExecContainer(getContext(), c) - return err -} |