diff options
author | Paul Holzinger <pholzing@redhat.com> | 2021-06-15 11:05:00 +0200 |
---|---|---|
committer | Paul Holzinger <pholzing@redhat.com> | 2021-06-16 16:43:30 +0200 |
commit | 666f555aa52b9f82da9d6ca64cf11e4f5e1e78e8 (patch) | |
tree | 0175dbf916bdb7d4722890191bb5f523f64b202f /pkg/domain/infra/abi/terminal | |
parent | e2f51eeb0693eda026fa509a9decfbdd7e0b74a8 (diff) | |
download | podman-666f555aa52b9f82da9d6ca64cf11e4f5e1e78e8.tar.gz podman-666f555aa52b9f82da9d6ca64cf11e4f5e1e78e8.tar.bz2 podman-666f555aa52b9f82da9d6ca64cf11e4f5e1e78e8.zip |
Fix resize race with podman exec -it
When starting a process with `podman exec -it` the terminal is resized
after the process is started. To fix this allow exec start to accept the
terminal height and width as parameter and let it resize right before
the process is started.
Fixes #10560
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'pkg/domain/infra/abi/terminal')
-rw-r--r-- | pkg/domain/infra/abi/terminal/terminal_linux.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/pkg/domain/infra/abi/terminal/terminal_linux.go b/pkg/domain/infra/abi/terminal/terminal_linux.go index ab71f8f6f..09c0f802d 100644 --- a/pkg/domain/infra/abi/terminal/terminal_linux.go +++ b/pkg/domain/infra/abi/terminal/terminal_linux.go @@ -15,12 +15,13 @@ import ( // ExecAttachCtr execs and attaches to a container func ExecAttachCtr(ctx context.Context, ctr *libpod.Container, execConfig *libpod.ExecConfig, streams *define.AttachStreams) (int, error) { - resize := make(chan define.TerminalSize) + var resize chan define.TerminalSize haveTerminal := terminal.IsTerminal(int(os.Stdin.Fd())) // Check if we are attached to a terminal. If we are, generate resize // events, and set the terminal to raw mode if haveTerminal && execConfig.Terminal { + resize = make(chan define.TerminalSize) cancel, oldTermState, err := handleTerminalAttach(ctx, resize) if err != nil { return -1, err @@ -32,7 +33,6 @@ func ExecAttachCtr(ctx context.Context, ctr *libpod.Container, execConfig *libpo } }() } - return ctr.Exec(execConfig, streams, resize) } |