zsh-users
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: Zsh Users <zsh-users@zsh.org>
Subject: Re: Do file descriptors survive to subshell?
Date: Mon, 12 Sep 2016 17:19:59 +0100	[thread overview]
Message-ID: <20160912171959.2516a91e@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <CAKc7PVBMgptkuPOmrcevDwsOrcWzeqO03G8xfr-aGoDade2EQg@mail.gmail.com>

It depends how the FD was opened.

> But the "survive FD" feature should work only for
> "exec zsh-5.2-dev-1", not "zsh-5.2-dev-1", shouldn't it ...

well, if you ran

  zsh-5.2-dev-1 3< myfile

you'd be a bit annoyed if FD 3 was closed, wouldn't you?
And of course 0, 1 and 2 are left open.

So for FDs opened by / known to the user, it's expected that they'll
survive; internal FDs used by the shell should be closed.  One example
of an FD the shell uses internally is for terminal management --- we
don't do this directly on the user-visible FDs for reasons I don't
think I ever fully understood.  Because this is opened early, it's
usualy FD 10, i.e. just outside the easily accessible range (that
traditionally shells keep away from allowing you to manipulate
directly) 0 to 9.

pws


  reply	other threads:[~2016-09-12 16:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20160912160148eucas1p1c7f423821260c611c9b34fbe47bfcf86@eucas1p1.samsung.com>
2016-09-12 15:29 ` Sebastian Gniazdowski
2016-09-12 16:19   ` Peter Stephenson [this message]
2016-09-12 16:29     ` Sebastian Gniazdowski
2016-09-12 18:24       ` Bart Schaefer
2016-09-13  8:54         ` Sebastian Gniazdowski
2016-09-14 17:53           ` Bart Schaefer
2016-09-15  6:41             ` Sebastian Gniazdowski

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=20160912171959.2516a91e@pwslap01u.europe.root.pri \
    --to=p.stephenson@samsung.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).