Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: stdbuf -o0 -i0 via a Zsh native interface?
- X-seq: zsh-workers 51796
- From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Cc: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>, Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: stdbuf -o0 -i0 via a Zsh native interface?
- Date: Fri, 26 May 2023 10:23:35 +0000
- Archived-at: <https://zsh.org/workers/51796>
- In-reply-to: <CAKc7PVDr4PtJ=gyc+8LyRdSPsA2wYQCGwxE2PP1+HG0JF9T+oQ@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <CAKc7PVAh95GL_kx1FiACaexEHsK8PVLrJ+T4KxnKTZr=5KDXMw@mail.gmail.com> <1297534493.4668003.1685024167868@mail.virginmedia.com> <CAH+w=7ZgA=80EP5peb6sO330hj2tY58LCJ=+7Lcr464L1A-JnQ@mail.gmail.com> <CAKc7PVCj6NFJ_BNkQcU_c6_TY=q7vP9kyF034k2250f0xWPFbg@mail.gmail.com> <CAH+w=7Yo93RmMZS5EkKXFMx+MXxfPMFdEQnaaq0MSkvSwCOaSw@mail.gmail.com> <CAKc7PVAdpW4UDPw8B6FgvXOJ29o-oDyG6isEM6Q1g5Qy9y6vWA@mail.gmail.com> <CAH+w=7ZbPmZWH1swPYDv-z+trheiKEO_Rz4wCU_AwbrUN7jpCA@mail.gmail.com> <CAKc7PVDr4PtJ=gyc+8LyRdSPsA2wYQCGwxE2PP1+HG0JF9T+oQ@mail.gmail.com>
I've took a look, and it seems to be easy:
1. Export LD_PRELOAD=/usr/lib/zsh/5.7/libzstdbuf.so
- https://github.com/coreutils/coreutils/blob/master/src/stdbuf.c#L196
- https://github.com/coreutils/coreutils/blob/master/src/stdbuf.c#L259
2. Provide stdbuf function in libzstdbuf.so:
- https://github.com/coreutils/coreutils/blob/master/src/libstdbuf.c#L139
Seems fairly simple…
On Fri, 26 May 2023 at 02:17, Sebastian Gniazdowski
<sgniazdowski@xxxxxxxxx> wrote:
>
> On Thu, 25 May 2023 at 21:21, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> >
> > Use with great caution, but to test the concept:
> >
> > TRAPDEBUG() { setopt err_exit; stdbuf -o0 -i0 ${(z)ZSH_DEBUG_CMD} }
>
> Interesting, I've never touched debug trap, this gives me a glimpse of
> how it is working.
>
> And as for the topic in general, I've had a moment of understanding
> that what's needed is basically: a `stdbuf` command that's *built-in*,
> and this comes down to your idea of `STTY=… my-cmd` -like
> inline-export variable, which is a nicer, more integrated version of a
> stdbuf-clone builtin (and could be made non-only-inline-export, to set
> once and forget). Now, who has time to look at stdbuf.c? :) To grasp
> what the LD-trick used there is?
>
> --
> Best regards,
> Sebastian Gniazdowski
--
Best regards,
Sebastian Gniazdowski
Messages sorted by:
Reverse Date,
Date,
Thread,
Author