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

Re: zargs parallelization support blows up with |&

On Jul 27,  2:36am, Dima Kogan wrote:
} [... when piping] stdout and
} stderr for some output, then ALL the processes are invoked at the same
} time, not just 2 at a time like I asked:
}  zargs -P2 -i -l1 `seq 10` -- perl -e 'sleep 20' {} |& grep x
} I don't know if this is a bug or an expected consequence of some
} internal implementation details, but this is a really nasty failure
} mode.

The problem is that when you append a pipe to the end, zargs ends up
as a subshell, and you can't do job control in a subshell (which you
would have seen if you weren't grepping stderr):

(eval):wait:1: can't manipulate jobs in subshell

The workaround for now is as follows:

Copy the zargs script file to somewhere in your $path, e.g. ~/bin/.

Edit the copy to add a #!/bin/zsh (or your local path) at the top,
and "chmod +x" the file.

Then either always run zargs as a script instead of an autoload, or
when you need to pipeline it, use "command zargs".  This is a little
less convenient because it loses access to interactively-defined
functions, but if you're zargs-ing another external command such as
perl it should work fine.

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