zsh-users
 help / color / mirror / code / Atom feed
From: Dominik Vogt <dominik.vogt@gmx.de>
To: zsh-users@sunsite.dk
Subject: Re: why does "jobs | wc" not work?
Date: Tue, 26 Nov 2002 12:42:22 +0100	[thread overview]
Message-ID: <20021126114222.GG1937@gmx.de> (raw)
In-Reply-To: <18744.1038308955@csr.com>

On Tue, Nov 26, 2002 at 11:09:15AM +0000, Peter Stephenson wrote:
> Dominik Vogt wrote:
> > There seems to be a strange bug with the jobs command in
> > zsh-4.0.4.  It seems that the output of the jobs command refuses
> > to go into a pipe.
> 
> This isn't strictly a bug, but there's a workaround in the 4.1 code.
> 
> In zsh
> 
> jobs | anything
> 
> causes the shell to fork for the left hand side of the pipeline.

Um, why must builtin commands run in a subshell?  I would have
naively thought commands like "echo something | ..." would just
run in the current shell.  Spawning a subshell sounds a bit
inefficient.

> This
> is then no longer the shell with the job control, hence doesn't show any
> jobs.  Other shells fork the `anything' and run `jobs' in the current
> shell.  We deliberately don't do that because we like to be able to do
> 
> anything | read foo
> 
> to get the variable $foo set in the current shell (and all sorts of similar
> examples).
> 
> In 4.1, we use the obvious workaround:  remember that we're in a subshell
> of an interactive shell and keep a fossilized list of the jobs.

Obvious, maybe, but it still sounds wrong in my ears.

> This can
> mean that the task list isn't up to date at the point where the jobs
> command is actually run --- though there are obvious races when
> background jobs terminate anyway, so I don't think that's a major
> concern.

Bye

Dominik ^_^  ^_^



  parent reply	other threads:[~2002-11-26 11:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-26 10:49 Dominik Vogt
2002-11-26 10:56 ` Vincent Lefevre
2002-11-26 11:09 ` Peter Stephenson
2002-11-26 11:17   ` Vincent Lefevre
2002-11-26 11:27     ` Peter Stephenson
2002-11-26 11:42   ` Dominik Vogt [this message]
2002-11-26 11:59     ` Vincent Lefevre
2002-11-26 12:08     ` Peter Stephenson
2002-11-26 12:48       ` Dominik Vogt
2002-11-26 13:05         ` Peter Stephenson
2002-11-26 13:33           ` Dominik Vogt
2002-11-26 17:20             ` Danek Duvall
2002-11-26 13:13         ` Vincent Lefevre
2002-11-26 11:24 ` Stephane Chazelas
2002-11-26 17:11 Borzenkov Andrey

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=20021126114222.GG1937@gmx.de \
    --to=dominik.vogt@gmx.de \
    --cc=zsh-users@sunsite.dk \
    /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).