zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Dima Kogan <dima@secretsauce.net>, zsh-workers@zsh.org
Subject: Re: zargs parallelization support blows up with |&
Date: Mon, 27 Jul 2015 09:15:12 -0700	[thread overview]
Message-ID: <150727091512.ZM6365@torch.brasslantern.com> (raw)
In-Reply-To: <87lhe23psr.fsf@secretsauce.net>

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.


  reply	other threads:[~2015-07-27 16:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-27  9:36 Dima Kogan
2015-07-27 16:15 ` Bart Schaefer [this message]
2015-07-27 16:37   ` Bart Schaefer
2015-07-27 18:19     ` Dima Kogan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=150727091512.ZM6365@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=dima@secretsauce.net \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).