Skip to content

Keypresses are swallowed when running docker-compose exec -T s1 mysql... | less #8428

@x-yuri

Description

@x-yuri

Description of the issue

When running commands like docker-compose exec -T s1 mysql... | less you've got to press keys twice (or more) for them to take effect. Although if the output is not long, it works correctly (every keypress leads to an action).

Context information (for bug reports)

Output of docker-compose version

docker-compose version 1.29.2, build unknown
docker-py version: 5.0.0
CPython version: 3.9.5
OpenSSL version: OpenSSL 1.1.1k  25 Mar 2021

Output of docker version

Client:
 Version:           20.10.7
 API version:       1.41
 Go version:        go1.16.4
 Git commit:        f0df35096d
 Built:             Fri Jun  4 08:14:39 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server:
 Engine:
  Version:          20.10.7
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.16.4
  Git commit:       b0f5bc36fe
  Built:            Fri Jun  4 08:14:24 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.5.2
  GitCommit:        36cc874494a56a253cd181a1a685b44b58a2e34a.m
 runc:
  Version:          1.0.0-rc95
  GitCommit:        b9ee9c6314599f1b4a7f497e1f1f856fe433d3b7
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Output of docker-compose config
(Make sure to add the relevant -f and other flags)

services:
  db:
    environment:
      MYSQL_ALLOW_EMPTY_PASSWORD: "true"
    image: mariadb:10.6
version: '3'

Steps to reproduce the issue

$ docker-compose up -d
$ docker-compose exec db mysql -e 'create database d1'
$ zcat dump.sql.gz | docker-compose exec -T db mysql d1

dump.sql.gz

Then run one of these commands:

$ docker-compose exec -T db mysqldump d1 | less
$ docker-compose exec -T db mysql -e 'select * from t1' d1 | less

And try pressing d, u, j, k, q.

Observed result

You've got press the keys twice (or more) for them to take effect. Although if you scroll down enough, they start working on the first press. If the dump is not big, it doesn't have this effect.

Expected result

The way it works with the following command:

$ docker exec $(docker-compose ps -q) mysql -e 'select * from t1' d1 | less

No keypresses are ignored, every keypress is acted upon.

Stacktrace / full error message

(paste here)

Additional information

UPD A simpler way to reproduce:

$ docker-compose exec -T db find / | less

Arch Linux

$ curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

$ less --version
less 581.2 (PCRE2 regular expressions)
Copyright (C) 1984-2021  Mark Nudelman

less comes with NO WARRANTY, to the extent permitted by law.
For information about the terms of redistribution,
see the file named README in the less distribution.
Home page: https://greenwoodsoftware.com/less

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions