zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: Re: process substitution and Ctrl-C
Date: Fri, 20 Aug 2010 08:24:18 -0700	[thread overview]
Message-ID: <100820082418.ZM29345@torch.brasslantern.com> (raw)
In-Reply-To: <20100820115218.GC16241@prunille.vinc17.org>

On Aug 20,  1:52pm, Vincent Lefevre wrote:
} Subject: Re: process substitution and Ctrl-C
}
} On 2010-08-20 01:19:05 -0700, Bart Schaefer wrote:
} > The process substitution can't really be synchronous in the sense of
} > sequential with respect to the rest of the job.
} 
} I don't think this is specific to process substitution. This should
} also be the case for pipelines [...]  But as far as I can see, a
} Ctrl-C interrupts all of them.

Yes, obviously.  The difference is that a pipeline is organized as a
process group whose leader's PID is recorded in the job table, so even
historically, it was all managed together as one job.  Conversely, a
process substitution (again historically) went into the background;
the closest pipeline analogy would be

    prg1 | ( exec prg2 & )

Subsequent changes mean this behavior is no longer necessary, it was
merely preserved so that the new code behaved like the old code.  I'm
not arguing that it should have been that way or should stay that way,
I'm just providing context.

} > On Aug 19, 11:17pm, Vincent Lefevre wrote:
} > } then the zsh prompt for the next command is displayed before "cat -n"
} > } finishes. Does this mean that process substitution should not be used
} > } for filtering, except when an end marker is used (as in the example
} > } at the end of my message)?
} > 
} > I'm not sure what question you're asking, [...]
} 
} What I mean here is: the problem is that the main shell doesn't wait
} for "cat -n" to finish.

Yes, I get that; what I don't follow is what that has to do with using
process substitution for filtering and whether or not there's an "end
marker".  Filtering implies that there's a downstream consumer of the
output of the filter, and using an end marker or not won't have any
effect on what's seen downstream.  If you botch handling EOF from the
upstream in the middle of a pipeline, you'll get the same problem you
had with your process substitution (except that you'll be able to
interrupt the pipeline, even in older zsh).

The reason the manual explicitly calls out that process substitutions
are run asynchronously is to warn you about the ( prg2 & ) behavior.
We're discussing whether to change that and I think PWS's last patch
does so, but in the meantime if you don't want the backgrounding effect,
you're correct, you can't use a process substitution as if it were the
tail of a pipeline.


  reply	other threads:[~2010-08-20 15:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-19 12:41 Vincent Lefevre
2010-08-19 13:07 ` Peter Stephenson
2010-08-19 17:15   ` Peter Stephenson
2010-08-19 20:18     ` Peter Stephenson
2010-08-19 15:32 ` Bart Schaefer
2010-08-19 20:37   ` Peter Stephenson
2010-08-19 21:17   ` Vincent Lefevre
2010-08-20  8:19     ` Bart Schaefer
2010-08-20 11:52       ` Vincent Lefevre
2010-08-20 15:24         ` Bart Schaefer [this message]
2010-08-21  0:04           ` Vincent Lefevre

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=100820082418.ZM29345@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@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).