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

Re: The elements of enlightenment



On Tue, Dec 6, 2022 at 8:45 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> On Tue, Dec 6, 2022 at 10:56 AM Roman Perepelitsa
> <roman.perepelitsa@xxxxxxxxx> wrote:
> >
> > That said, it's totally possible to extend zsh with something like $[
> > ... ] which would work like $( ... ) but without forking. It would run
> > the commands in another thread within the same process.
>
> That requires enabling support from threading libraries like pthreads,
> which bring along their own set of availability and synchronization
> challenges.

Yeah, it's probably non-trivial. Thankfully, it wouldn't require
inserting mutex locks in random places because the parent shell will
never be executing concurrently with the child. It'll be blocked while
the child is running. Signal handling might need changes though. I
don't know this part of the code well enough to know whether they
would be big or not.

I'm not suggesting that it's a good idea to implement $[ ... ]. I'm
just musing on the topic of capturing stdout from zsh code without
forking.

Roman.




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