From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh hackers list <zsh-workers@sunsite.dk>
Subject: Re: multios and unnecessary processes
Date: Mon, 10 Jan 2005 19:20:41 +0000 [thread overview]
Message-ID: <1050110192041.ZM27325@candle.brasslantern.com> (raw)
In-Reply-To: <20050110171101.GD4432@sc>
On Jan 10, 5:11pm, Stephane Chazelas wrote:
} Subject: Re: multios and unnecessary processes
}
} However to get back to my initial statement, don't you agree
} it's a problem that
}
} cmd >&2 >&- >&2
}
} doesn't redirect stdout to stderr but to a pipe to a background
} process that just echos the output to stderr?
Yes, that could be considered a bug. Suggested patch below.
But under what circumstances would you write that?
The only case where I can think offhand of that coming up is something
like this:
original_cmd="lsof -ag $$ -d 0-2,10-15 >&2"
# ... time and code passes ...
modified_cmd="$original_cmd >&-"
# ... more time and code passes ...
finished_cmd="$modified_cmd >&2"
eval $finished_cmd
Here's the patch. This relies on the fact that mfds[] elements are heap
allocated; it also means that repeatedly opening and closing a descriptor
with MULTIOS on will repeatedly allocate and discard a multio structure,
whereas before it would re-use it even after closing.
Patch line numbers may be off because I've applied 20632 (PWS, I think
you could commit that, it seems to be fine).
Index: Src/exec.c
===================================================================
RCS file: /extra/cvsroot/zsh/zsh-4.0/Src/exec.c,v
retrieving revision 1.22
diff -c -r1.22 exec.c
--- exec.c 6 Dec 2004 16:51:18 -0000 1.22
+++ exec.c 10 Jan 2005 19:08:51 -0000
@@ -1487,6 +1488,7 @@
}
_exit(0);
}
+ mfds[fd] = NULL;
}
/* close all the mnodes (failure) */
next prev parent reply other threads:[~2005-01-10 19:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-09 16:47 Stephane Chazelas
2005-01-09 20:32 ` Bart Schaefer
2005-01-10 9:49 ` Stephane Chazelas
2005-01-10 16:53 ` Bart Schaefer
2005-01-10 17:11 ` Stephane Chazelas
2005-01-10 19:20 ` Bart Schaefer [this message]
2005-01-10 19:48 ` Peter Stephenson
2005-01-11 9:07 ` Stephane Chazelas
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=1050110192041.ZM27325@candle.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=zsh-workers@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).