diff options
| -rw-r--r-- | cmd/podmanV2/containers/kill.go | 9 | ||||
| -rw-r--r-- | cmd/podmanV2/containers/pause.go | 9 | ||||
| -rw-r--r-- | cmd/podmanV2/containers/restart.go | 9 | ||||
| -rw-r--r-- | cmd/podmanV2/containers/rm.go | 9 | ||||
| -rw-r--r-- | cmd/podmanV2/containers/stop.go | 9 | ||||
| -rw-r--r-- | cmd/podmanV2/containers/unpause.go | 9 | ||||
| -rw-r--r-- | cmd/podmanV2/containers/wait.go | 9 | ||||
| -rw-r--r-- | libpod/container_exec.go | 10 | ||||
| -rw-r--r-- | libpod/oci_conmon_linux.go | 1 | 
9 files changed, 41 insertions, 33 deletions
diff --git a/cmd/podmanV2/containers/kill.go b/cmd/podmanV2/containers/kill.go index 36c4f2528..6e6debfec 100644 --- a/cmd/podmanV2/containers/kill.go +++ b/cmd/podmanV2/containers/kill.go @@ -15,10 +15,11 @@ import (  var (  	killDescription = "The main process inside each container specified will be sent SIGKILL, or any signal specified with option --signal."  	killCommand     = &cobra.Command{ -		Use:   "kill [flags] CONTAINER [CONTAINER...]", -		Short: "Kill one or more running containers with a specific signal", -		Long:  killDescription, -		RunE:  kill, +		Use:               "kill [flags] CONTAINER [CONTAINER...]", +		Short:             "Kill one or more running containers with a specific signal", +		Long:              killDescription, +		RunE:              kill, +		PersistentPreRunE: preRunE,  		Args: func(cmd *cobra.Command, args []string) error {  			return parse.CheckAllLatestAndCIDFile(cmd, args, false, false)  		}, diff --git a/cmd/podmanV2/containers/pause.go b/cmd/podmanV2/containers/pause.go index 99ca34d5c..a9b91b68f 100644 --- a/cmd/podmanV2/containers/pause.go +++ b/cmd/podmanV2/containers/pause.go @@ -15,10 +15,11 @@ import (  var (  	pauseDescription = `Pauses one or more running containers.  The container name or ID can be used.`  	pauseCommand     = &cobra.Command{ -		Use:   "pause [flags] CONTAINER [CONTAINER...]", -		Short: "Pause all the processes in one or more containers", -		Long:  pauseDescription, -		RunE:  pause, +		Use:               "pause [flags] CONTAINER [CONTAINER...]", +		Short:             "Pause all the processes in one or more containers", +		Long:              pauseDescription, +		RunE:              pause, +		PersistentPreRunE: preRunE,  		Example: `podman pause mywebserver    podman pause 860a4b23    podman pause -a`, diff --git a/cmd/podmanV2/containers/restart.go b/cmd/podmanV2/containers/restart.go index 216824389..053891f79 100644 --- a/cmd/podmanV2/containers/restart.go +++ b/cmd/podmanV2/containers/restart.go @@ -18,10 +18,11 @@ var (    A timeout before forcibly stopping can be set, but defaults to 10 seconds.`  	restartCommand = &cobra.Command{ -		Use:   "restart [flags] CONTAINER [CONTAINER...]", -		Short: "Restart one or more containers", -		Long:  restartDescription, -		RunE:  restart, +		Use:               "restart [flags] CONTAINER [CONTAINER...]", +		Short:             "Restart one or more containers", +		Long:              restartDescription, +		RunE:              restart, +		PersistentPreRunE: preRunE,  		Args: func(cmd *cobra.Command, args []string) error {  			return parse.CheckAllLatestAndCIDFile(cmd, args, false, false)  		}, diff --git a/cmd/podmanV2/containers/rm.go b/cmd/podmanV2/containers/rm.go index 916dd2577..75655e4cd 100644 --- a/cmd/podmanV2/containers/rm.go +++ b/cmd/podmanV2/containers/rm.go @@ -19,10 +19,11 @@ var (    Command does not remove images. Running or unusable containers will not be removed without the -f option.`  	rmCommand = &cobra.Command{ -		Use:   "rm [flags] CONTAINER [CONTAINER...]", -		Short: "Remove one or more containers", -		Long:  rmDescription, -		RunE:  rm, +		Use:               "rm [flags] CONTAINER [CONTAINER...]", +		Short:             "Remove one or more containers", +		Long:              rmDescription, +		RunE:              rm, +		PersistentPreRunE: preRunE,  		Args: func(cmd *cobra.Command, args []string) error {  			return parse.CheckAllLatestAndCIDFile(cmd, args, false, true)  		}, diff --git a/cmd/podmanV2/containers/stop.go b/cmd/podmanV2/containers/stop.go index b6d70784d..58d47fd52 100644 --- a/cmd/podmanV2/containers/stop.go +++ b/cmd/podmanV2/containers/stop.go @@ -18,10 +18,11 @@ var (    A timeout to forcibly stop the container can also be set but defaults to 10 seconds otherwise.`  	stopCommand = &cobra.Command{ -		Use:   "stop [flags] CONTAINER [CONTAINER...]", -		Short: "Stop one or more containers", -		Long:  stopDescription, -		RunE:  stop, +		Use:               "stop [flags] CONTAINER [CONTAINER...]", +		Short:             "Stop one or more containers", +		Long:              stopDescription, +		RunE:              stop, +		PersistentPreRunE: preRunE,  		Args: func(cmd *cobra.Command, args []string) error {  			return parse.CheckAllLatestAndCIDFile(cmd, args, false, true)  		}, diff --git a/cmd/podmanV2/containers/unpause.go b/cmd/podmanV2/containers/unpause.go index 8b8cde9b2..6a3179f10 100644 --- a/cmd/podmanV2/containers/unpause.go +++ b/cmd/podmanV2/containers/unpause.go @@ -15,10 +15,11 @@ import (  var (  	unpauseDescription = `Unpauses one or more previously paused containers.  The container name or ID can be used.`  	unpauseCommand     = &cobra.Command{ -		Use:   "unpause [flags] CONTAINER [CONTAINER...]", -		Short: "Unpause the processes in one or more containers", -		Long:  unpauseDescription, -		RunE:  unpause, +		Use:               "unpause [flags] CONTAINER [CONTAINER...]", +		Short:             "Unpause the processes in one or more containers", +		Long:              unpauseDescription, +		RunE:              unpause, +		PersistentPreRunE: preRunE,  		Example: `podman unpause ctrID    podman unpause --all`,  	} diff --git a/cmd/podmanV2/containers/wait.go b/cmd/podmanV2/containers/wait.go index 4367fd9d9..bf3c86200 100644 --- a/cmd/podmanV2/containers/wait.go +++ b/cmd/podmanV2/containers/wait.go @@ -18,10 +18,11 @@ var (  	waitDescription = `Block until one or more containers stop and then print their exit codes.  `  	waitCommand = &cobra.Command{ -		Use:   "wait [flags] CONTAINER [CONTAINER...]", -		Short: "Block on one or more containers", -		Long:  waitDescription, -		RunE:  wait, +		Use:               "wait [flags] CONTAINER [CONTAINER...]", +		Short:             "Block on one or more containers", +		Long:              waitDescription, +		RunE:              wait, +		PersistentPreRunE: preRunE,  		Args: func(cmd *cobra.Command, args []string) error {  			return parse.CheckAllLatestAndCIDFile(cmd, args, false, false)  		}, diff --git a/libpod/container_exec.go b/libpod/container_exec.go index 7ed7a3343..6b88e5205 100644 --- a/libpod/container_exec.go +++ b/libpod/container_exec.go @@ -575,7 +575,7 @@ func (c *Container) ExecResize(sessionID string, newSize remotecommand.TerminalS  		return errors.Wrapf(define.ErrNoSuchExecSession, "container %s has no exec session with ID %s", c.ID(), sessionID)  	} -	logrus.Infof("Removing container %s exec session %s", c.ID(), session.ID()) +	logrus.Infof("Resizing container %s exec session %s to %+v", c.ID(), session.ID(), newSize)  	if session.State != define.ExecStateRunning {  		return errors.Wrapf(define.ErrExecSessionStateInvalid, "cannot resize container %s exec session %s as it is not running", c.ID(), session.ID()) @@ -592,9 +592,6 @@ func (c *Container) Exec(config *ExecConfig, streams *AttachStreams, resize <-ch  	if err != nil {  		return -1, err  	} -	if err := c.ExecStartAndAttach(sessionID, streams); err != nil { -		return -1, err -	}  	// Start resizing if we have a resize channel.  	// This goroutine may likely leak, given that we cannot close it here. @@ -605,6 +602,7 @@ func (c *Container) Exec(config *ExecConfig, streams *AttachStreams, resize <-ch  	// session.  	if resize != nil {  		go func() { +			logrus.Debugf("Sending resize events to exec session %s", sessionID)  			for resizeRequest := range resize {  				if err := c.ExecResize(sessionID, resizeRequest); err != nil {  					// Assume the exec session went down. @@ -615,6 +613,10 @@ func (c *Container) Exec(config *ExecConfig, streams *AttachStreams, resize <-ch  		}()  	} +	if err := c.ExecStartAndAttach(sessionID, streams); err != nil { +		return -1, err +	} +  	session, err := c.ExecSession(sessionID)  	if err != nil {  		return -1, err diff --git a/libpod/oci_conmon_linux.go b/libpod/oci_conmon_linux.go index 82c5d7020..6d9a976cb 100644 --- a/libpod/oci_conmon_linux.go +++ b/libpod/oci_conmon_linux.go @@ -793,7 +793,6 @@ func (r *ConmonOCIRuntime) ExecAttachResize(ctr *Container, sessionID string, ne  	}  	defer controlFile.Close() -	logrus.Debugf("Received a resize event for container %s exec session %s: %+v", ctr.ID(), sessionID, newSize)  	if _, err = fmt.Fprintf(controlFile, "%d %d %d\n", 1, newSize.Height, newSize.Width); err != nil {  		return errors.Wrapf(err, "failed to write to ctl file to resize terminal")  	}  | 
