Subject: bug#12689: 24.2; Eshell ${cmd} substitution

From: Eli Zaretskii <[email-masked]>
Date: Wed, 04 Mar 2015 19:38:30 +0200

> Date: Wed, 04 Mar 2015 04:14:07 -0800
> From: Samer Masterson <[email-masked]>
> Cc: [email-masked]
> 
> On Tue, Mar 3, 2015 at 7:54 AM, Eli Zaretskii <[email-masked]> wrote:
> 
>     Does this have any effect on the feature where Eshell can run several
>     commands simultaneously via a shell-like pipe? Thanks.
> 
> I don't know what feature you're describing.

eshell-execute-pipeline was what I had in mind.

It's been a while since I last hacked Eshell, so perhaps that was a
stupid question, but what prompted it was the fact that your change
would wait until a process exited under some conditions, so I wondered
whether it will prevent Eshell from firing up several asynchronous
processes connected through a pipe.

> Here is the output from running
> regular pipes:
> 
> ~ $ echo hello | /bin/echo there | /bin/echo hey | echo hi # Without patch
> hi
> hey
> ~ $ echo hello | /bin/echo there | /bin/echo hey | echo hi # With patch
> hi
> hey
> there
> hello

Not sure why you intersperse internal and external echo, or why did
you use echo to begin with.

In any case, what you see are bugs, at least in the case of a pipe
that cannot connect because the receiving end doesn't read stdin.

> First, we should ignore the fact that echo does nothing with stdin, and the
> above commands print "hi" in bash. I do not understand why the command without
> the patch only prints out "hey\nhi", but it printed that consistently on my
> computer. The second output is incorrect (or at the very least unexpected?),
> but less incorrect than the first. If this is what you were talking about, then
> the commands may have appeared to be simultaneous because they were racing, but
> I'm not sure if that's intentional.

I'd rather see that a pipe that does make sense, something like

  cat some-large-file | wc

with external commands works as expected, and both programs run
simultaneously in parallel (e.g., according to 'top' or a similar
tool), not sequentially.

Thanks.