mirror of
https://github.com/containers/podman.git
synced 2025-08-06 11:32:07 +08:00
Merge pull request #4010 from haircommander/regsiter-later
exec: Register resize func a bit later
This commit is contained in:
@ -107,8 +107,6 @@ func (c *Container) attachToExec(streams *AttachStreams, keys string, resize <-c
|
|||||||
|
|
||||||
logrus.Debugf("Attaching to container %s exec session %s", c.ID(), sessionID)
|
logrus.Debugf("Attaching to container %s exec session %s", c.ID(), sessionID)
|
||||||
|
|
||||||
registerResizeFunc(resize, c.execBundlePath(sessionID))
|
|
||||||
|
|
||||||
// set up the socket path, such that it is the correct length and location for exec
|
// set up the socket path, such that it is the correct length and location for exec
|
||||||
socketPath := buildSocketPath(c.execAttachSocketPath(sessionID))
|
socketPath := buildSocketPath(c.execAttachSocketPath(sessionID))
|
||||||
|
|
||||||
@ -116,6 +114,7 @@ func (c *Container) attachToExec(streams *AttachStreams, keys string, resize <-c
|
|||||||
if _, err := readConmonPipeData(attachFd, ""); err != nil {
|
if _, err := readConmonPipeData(attachFd, ""); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2: then attach
|
// 2: then attach
|
||||||
conn, err := net.DialUnix("unixpacket", nil, &net.UnixAddr{Name: socketPath, Net: "unixpacket"})
|
conn, err := net.DialUnix("unixpacket", nil, &net.UnixAddr{Name: socketPath, Net: "unixpacket"})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -127,6 +126,10 @@ func (c *Container) attachToExec(streams *AttachStreams, keys string, resize <-c
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
// Register the resize func after we've read the attach socket, as we know at this point the
|
||||||
|
// 'ctl' file has been created in conmon
|
||||||
|
registerResizeFunc(resize, c.execBundlePath(sessionID))
|
||||||
|
|
||||||
// start listening on stdio of the process
|
// start listening on stdio of the process
|
||||||
receiveStdoutError, stdinDone := setupStdioChannels(streams, conn, detachKeys)
|
receiveStdoutError, stdinDone := setupStdioChannels(streams, conn, detachKeys)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user