Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Input next command(s) while current is running

Thank you for your clarification

Best regards

On Mon, Oct 18, 2021 at 4:26 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
On Mon, Oct 18, 2021 at 12:15 AM Mohamed Jebali
<amxmodx.unloco@xxxxxxxxx> wrote:
> My suggestion is to pause the output of the current command when I'm typing and then resume it when I either hit enter or escape.

This has nothing to do with the shell and everything to do with the
terminal (or emulator) that you are using.

While a foreground command is running, the shell is entirely stopped,
waiting for that command to finish. It does not see or react to your
keystrokes.  Even the ^C interrupt is processed by the terminal
(strictly, the terminal and its I/O driver) and translated into a
signal sent to the foreground command.

So when you "type ahead" it is the terminal that is collecting and
buffering your keystrokes, which are then finally read by whatever
first asks for more input, which is the shell if and only if the
foreground command never wants to read from the terminal.

You wouldn't want the behavior you've described during an editor
session, for example, or a pager.

Messages sorted by: Reverse Date, Date, Thread, Author