Skip to content

Tmux client discards stdin when starting #2909

@romkatv

Description

@romkatv

When tmux client starts, it discards all buffered input.

  1. Run: sh -c 'sleep 5; tmux'
  2. Quickly type echo hello and hit ENTER.
  3. Wait for tmux to start login shell.
  4. Observe that neither the echo hello command nor its output appear on the screen. This is unexpected. The expected behavior is the same as if step (2) was performed after step (3).

Other programs don't discard buffered input. For example, try replacing tmux in the command given above with head -1, sh, or screen -q.

I've reproduced this on Linux x86_64 (Ubuntu 20.04) with tmux 3.2a and bf595a0 (the tip of master at the time of this writing). I don't have .tmux.conf. My TERM is xterm-256color. Logs from tmux: tmux-logs.tar.gz.

The logs were captured in the following environment:

docker run -e TERM -e LC_ALL=C.UTF-8 -it --rm ubuntu:focal bash -xuec '
  cd
  export DEBIAN_FRONTEND=noninteractive
  apt-get update
  apt-get upgrade -y
  apt-get install -y git libevent-dev ncurses-dev build-essential bison pkg-config autogen autoconf screen
  git clone https://github.com/tmux/tmux.git
  cd tmux
  sh ./autogen.sh
  ./configure --prefix /tmp/tmux --exec-prefix /tmp/tmux
  make install
  cd
  exec bash'

The actual command I ran to generate logs:

sh -c 'sleep 5; /tmp/tmux/bin/tmux -vv'

I typed echo hello and hit ENTER while sleep 5 was running. When bash prompt showed up, I pressed Ctrl-D.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions