If I run a command with a lot of output in tmux, but decide to cancel it with Ctrl-C, there's a 10-15 second lag before it stops. However, if I do the same thing outside of tmux, it stops immediately. Why is this, and is it fixable?
In practice, this issue comes up when I'm doing grep -R
on a large directory and my search isn't constrained enough. A workaround would be to pipe the result to wc
first to make sure the output isn't too long, but that's just another step I'd like to avoid.
Notes:
- This has the same behavior in Gnome Terminal, uxterm, st, and a plain virtual terminal (e.g., ctrl-alt-f2), but the delay is less in the plain virtual terminal.
- I'm not the only one: http://www.mail-archive.com/tmux-users@lists.sourceforge.net/msg01569.html
- The delay is longer if my terminal window is larger. For a fullscreen terminal, it takes about 15 seconds to stop
grep -R
(no other arguments) in a cluttered home directory. For a 80×25 character terminal, it stops almost immediately.
grep -R "a" ~/
(not writing to file) ... andyes | nl | cut -f1 | head -9999999 > ~/file
thencat ~/file
.