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

Re: "echo | ps -j $(:) | cat | cat | cat" runs components in different process groups



On Mon, 16 Apr 2018 22:39:10 -0700
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> So if, when we determine that "&" is the command separator, we could
> treat the command in the way the "time" prefix does, this would all
> work out without mangling execcmd_exec() and prefork().

That's good, I think that's probably worth doing.

> However, there are some other unique zsh-isms that would be altered
> by this.  For example:
> 
> % echo ${foo::=bar} & echo $foo
> [1] 31940
> bar
> % bar
> 
> [1]  + done       echo ${foo::=bar}
> % unset foo
> % time echo ${foo::=bar} & echo $foo
> [1] 31943
> 
> % bar
> 
> [1]  + done       time echo ${foo::=bar}
> % 
> 
> Note the assignment "sticks" in the current shell in the first case,
> because it happens before the fork, but is lost in the second case.
> Perhaps the former is a bug as well.

It certainly looks rather unexpected.  I think most of us staring at it
would assume the entire command line was evaluated in the background.
It's hard to believe anyone is deliberately relying on this behaviour.
I think it would be fine to change with a note about the
incompatibility.

pws



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