summaryrefslogtreecommitdiff
path: root/libpod/container_attach.go
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2018-03-04 14:19:46 +0100
committerAtomic Bot <atomic-devel@projectatomic.io>2018-03-06 20:47:46 +0000
commitbbf9a313c3f835f452cfab0dd09f13116f673814 (patch)
tree5e01acdc96a9db91834e6826bb7416b5723de139 /libpod/container_attach.go
parent5ca69aaa419a774495357f371b3360223fbfc01b (diff)
downloadpodman-bbf9a313c3f835f452cfab0dd09f13116f673814.tar.gz
podman-bbf9a313c3f835f452cfab0dd09f13116f673814.tar.bz2
podman-bbf9a313c3f835f452cfab0dd09f13116f673814.zip
attach: set the terminal size and handle SIGWINCH
Notify conmon when the terminal size changes. Use the same notification to set the correct initial size. Closes: https://github.com/projectatomic/libpod/issues/351 Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com> Closes: #448 Approved by: baude
Diffstat (limited to 'libpod/container_attach.go')
-rw-r--r--libpod/container_attach.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/libpod/container_attach.go b/libpod/container_attach.go
index 86bf7ee14..25e8bcdac 100644
--- a/libpod/container_attach.go
+++ b/libpod/container_attach.go
@@ -56,17 +56,17 @@ func (c *Container) attachContainerSocket(resize <-chan remotecommand.TerminalSi
term.SetRawTerminal(inputStream.Fd())
}
- controlPath := filepath.Join(c.bundlePath(), "ctl")
- controlFile, err := os.OpenFile(controlPath, unix.O_WRONLY, 0)
- if err != nil {
- return errors.Wrapf(err, "failed to open container ctl file")
- }
- defer controlFile.Close()
-
kubecontainer.HandleResizing(resize, func(size remotecommand.TerminalSize) {
- logrus.Debugf("Received a resize event: %+v", size)
- _, err := fmt.Fprintf(controlFile, "%d %d %d\n", 1, size.Height, size.Width)
+ controlPath := filepath.Join(c.bundlePath(), "ctl")
+ controlFile, err := os.OpenFile(controlPath, unix.O_WRONLY, 0)
if err != nil {
+ logrus.Debugf("Could not open ctl file: %v", err)
+ return
+ }
+ defer controlFile.Close()
+
+ logrus.Debugf("Received a resize event: %+v", size)
+ if _, err = fmt.Fprintf(controlFile, "%d %d %d\n", 1, size.Height, size.Width); err != nil {
logrus.Warnf("Failed to write to control file to resize terminal: %v", err)
}
})