bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#46351: 28.0.50; Add convenient way to bypass Eshell's own pipelining


From: Sean Whitton
Subject: bug#46351: 28.0.50; Add convenient way to bypass Eshell's own pipelining
Date: Tue, 18 Jan 2022 16:16:01 -0700
User-agent: Notmuch/0.31.4 (https://notmuchmail.org) Emacs/29.0.50 (x86_64-pc-linux-gnu)

Hello,

On Tue 18 Jan 2022 at 09:38PM +02, Eli Zaretskii wrote:

> OK, but I don't think I see how this answers my question.  Is it
> possible today to say
>
>   >foo something or other
>
> in Eshell, and have the output of 'something' redirected to 'foo'?  If
> it is possible today, will it be possible after your changes, and what
> will happen with that if 'something' includes the new "*|" pipe
> symbol?

Interestingly, it's not possible to do that with plain Eshell.  If
someone modifies Eshell's parsing to make it possible, I do not believe
it will interact with em-extpipe.el in any meaningful way.

Even though

    >blah echo "Hello"

doesn't work, with my patch, these three do, and all output to "blah":

    *>blah echo "Hello"
    echo "Hello" *| cat >blah
    echo "Hello" *| >blah cat

If you do

    >blah echo "Hello" *| rev

then on my system, "blah" contains "Hello", not "olleH", as it looks
like GNU bash prioritises the output redirection over the pipe.

To answer your question directly, then, if 'something' contains *| then
the external shell will be asked to redirect the output of the first
command to the file foo and also to pipe it to a second command, and I
guess some shells might duplicate the output and others will just choose
one destination; maybe POSIX has something to say about it.

>> > Why do these tests only look for 'sh' as the shell?  What is the
>> > importance of the shell for this purpose?
>>
>> The code just substitutes in the value of `shell-file-name' (taking
>> TRAMP into account), so there isn't much point in varying that value in
>> the tests, so I just picked something standard.  The user is expected to
>> know what syntax their external shell will accept and what it will do
>> with it when they invoke this functionality.
>
> Does this mean that those tests will not run on systems where 'sh' is
> not available?

No, they will run on any system that Emacs runs on.  They test the
parsing and rewriting done by em-extpipe.el.  Actually executing
commands is tested by test/lisp/eshell/eshell-tests.el.  Executing the
commands is not specific to em-extpipe.el.

-- 
Sean Whitton





reply via email to

[Prev in Thread] Current Thread [Next in Thread]