zsh-workers
 help / color / mirror / code / Atom feed
From: Zefram <zefram@fysh.org>
To: Peter Stephenson <pws@pwstephenson.fsnet.co.uk>
Cc: Zsh hackers list <zsh-workers@sunsite.auc.dk>
Subject: Re: More tests
Date: Wed, 22 Dec 1999 10:47:31 +0000 (GMT)	[thread overview]
Message-ID: <E120jIp-0000Nf-00@crucigera.fysh.org> (raw)
In-Reply-To: <E120XrM-00073o-00.1999-12-21-22-34-25@mail4.svr.pol.co.uk> from Peter Stephenson at "Dec 21, 1999 10:35:40 pm"

Peter Stephenson wrote:
>2. There's something wrong with synchronisation in multios:
>% print hello >foo >bar && print "$(<foo)"
>

What happens here is that stdout for the first print is a pipe to a
process doing what amounts to a tee.  After the print, that pipe gets
closed, the tee process notices this and exits, after it's written all
the pending data to its outputs.  However, this is fundamentally done
asynchronously.  Closing the tee's input does not immediately force
the tee to complete.  Quite feasibly, the print could send its output
and close tee's input and then the empty foo gets read, all in a single
timeslice, before tee has had a chance to look at its input.

To fix this, closing the redirected fd would have to also wait for the
tee process to exit.  This should be doable by storing pids in the save
array and waiting in fixfds().  There's also the subtlety of nested tees
to handle.  Might be easier just to save all the necessary pids in a
single linked list, separately from the saved fd information; we don't
really need to correlate them.

There's a similar issue with input multios.  The closing of the multio fd
should guarantee that all the input files have been closed.  This could
be done most easily by directly killing the cat process (at this point,
we *want* to lose any data it has buffered).

-zefram


  reply	other threads:[~1999-12-22 10:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-12-21 22:35 Peter Stephenson
1999-12-22 10:47 ` Zefram [this message]
1999-12-22 21:55 ` Tanaka Akira

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=E120jIp-0000Nf-00@crucigera.fysh.org \
    --to=zefram@fysh.org \
    --cc=pws@pwstephenson.fsnet.co.uk \
    --cc=zsh-workers@sunsite.auc.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).