help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zach Riggle <zachriggle@gmail.com>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: Multios redirection while keeping current descriptors, and exec
Date: Tue, 10 May 2022 11:54:01 -0700	[thread overview]
Message-ID: <CAH+w=7ZtH0vVc0uhVRL2UUU5JP3Ntq3KucwyEsf1xkV4=EH0KQ@mail.gmail.com> (raw)
In-Reply-To: <CAMP9c5mqbBiyW_Qo2cU-sn+TRhn6KE6WmJz9ujN=cPwTU2j1Pw@mail.gmail.com>

On Tue, May 10, 2022 at 11:21 AM Zach Riggle <zachriggle@gmail.com> wrote:
> Is there a simpler way to additionally log stdout/stderr to a file, while keeping the existing one?

Your best bet for that may be to use something like the "script"
command, or see if your terminal emulator can keep a log.

There is a long-standing bug with using multios with a "naked exec"
... but that will be fixed as of the 5.9 release, at which point
you'll be able to do e.g.:

exec 2>/tmp/err 2>/dev/tty

The drawback to this is that the background process that manages the
two outputs is not synchronized with ZLE, so you may not see the full
output as soon as you expect and/or the next prompt may be mixed into
the output.  The prompts themselves don't go to stdout or stderr,

You can garble this a bit less by setting up something with "zle -F"
to watch for text appearing in the log file, but you have to do so
carefully to avoid deadlock if the volume of output exceeds the OS's
internal I/O buffer space.

      parent reply	other threads:[~2022-05-10 18:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-10 18:20 Zach Riggle
2022-05-10 18:49 ` John Covici
2022-05-10 18:54 ` Bart Schaefer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH+w=7ZtH0vVc0uhVRL2UUU5JP3Ntq3KucwyEsf1xkV4=EH0KQ@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=zachriggle@gmail.com \
    --cc=zsh-users@zsh.org \
    --subject='Re: Multios redirection while keeping current descriptors, and exec' \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this inbox:


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).