zsh-users
 help / color / mirror / code / Atom feed
* process substitution bug with set -e?
@ 2013-10-14 12:41 Vincent Lefevre
  2013-10-14 13:48 ` Peter Stephenson
  0 siblings, 1 reply; 9+ messages in thread
From: Vincent Lefevre @ 2013-10-14 12:41 UTC (permalink / raw)
  To: zsh-users

The zshexpn(1) man page of zsh 5.0.2 says:

  There  is  an additional problem with >(process); when this is attached
  to an external command, the parent shell does not wait for  process  to
  finish  and  hence  an immediately following command cannot rely on the
  results being complete.  The problem  and  solution  are  the  same  as
  described  in the section MULTIOS in zshmisc(1).  Hence in a simplified
  version of the example above:

         paste <(cut -f1 file1) <(cut -f3 file2) > >(process)

  (note that no MULTIOS are involved), process will be run asynchronously
  as far as the parent shell is concerned.  The workaround is:

         { paste <(cut -f1 file1) <(cut -f3 file2) } > >(process)

  The  extra  processes here are spawned from the parent shell which will
  wait for their completion.

Now, consider the following script:

#!/usr/bin/env zsh
set -e
{ /bin/cp } 2>>(sleep 1; cat -n)

Due to /bin/cp failure and the "set -e", the parent shell exits
immediately, without waiting for the extra processes:

ypig% ./zsh-procsubst
ypig%      1    /bin/cp: missing file operand
     2  Try '/bin/cp --help' for more information.

(tested under Debian/unstable).

Shouldn't the parent shell wait in this case?

If this is the expected behavior, the man page should be fixed,
and possibly give another workaround in the case of set -e.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-10-16 17:54 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-14 12:41 process substitution bug with set -e? Vincent Lefevre
2013-10-14 13:48 ` Peter Stephenson
2013-10-14 15:08   ` Vincent Lefevre
2013-10-14 16:23     ` Bart Schaefer
2013-10-14 16:28     ` Peter Stephenson
2013-10-14 17:47       ` Bart Schaefer
2013-10-15  8:42         ` Peter Stephenson
2013-10-15 14:29           ` Bart Schaefer
2013-10-16 17:53             ` Peter Stephenson

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).