Zsh Mailing List Archive
Messages sorted by:
- X-seq: zsh-users 24912
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Pier Paolo Grassi <pierpaolog@xxxxxxxxx>
- Subject: Re: subprocess
- Date: Mon, 8 Jun 2020 14:32:47 -0700
- Cc: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>, Mikael Magnusson <mikachu@xxxxxxxxx>, Zsh-Users List <zsh-users@xxxxxxx>
- In-reply-to: <CAP+y1xBLJzx++sV=KJ3LfGsQ=uL+w35AFYc90UEp4qGbk=aP8g@mail.gmail.com>
- List-help: <mailto:email@example.com>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:firstname.lastname@example.org>
- List-unsubscribe: <mailto:email@example.com>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CAP+y1xAKauPdSQO7XKRBYrFKFuWQCuDg8hmBRrbFTaKr2wMYdA@mail.gmail.com> <CAHYJk3SLwb1f1o9Ow1otbYDH1epXBz0=1Lr6B-tJtoGDGQEWXQ@mail.gmail.com> <firstname.lastname@example.org> <CAH+w=7bEco_BFsyzVC+BNHh7W55K7ttSNsKEu0TByXK-eAhyOQ@mail.gmail.com> <CAP+y1xBLJzx++sV=KJ3LfGsQ=uL+w35AFYc90UEp4qGbk=aP8g@mail.gmail.com>
On Mon, Jun 8, 2020 at 7:22 AM Pier Paolo Grassi <pierpaolog@xxxxxxxxx> wrote:
> What would be the best way to learn more about these mechanisms without
> digging in the source code of the shell or the kernel?
Hmm. Digging in the source code probably isn't the best way even if
you were interested. It's a tough question.
This is all documented, but not in any single coherent place, mostly
because there are just too many possible ways to combine things to
explain all the variations. For example the closing of all
descriptors >= 10 when starting a new job is long-standing,
standardized shell behavior, so the zsh manual doesn't mention it,
you're just expected to have learned (elsewhere) that is how shells
work. I'm not sure the "named functions get their own job" part is
explained very clearly anywhere, but it is explained that anonymous
functions do not behave that way. (E.g., "Redirections may be applied
to the anonymous function in the same manner as to a current-shell
structure enclosed in braces.") It's explained that <(...) uses a
special file representing a file descriptor ("If the system supports
the /dev/fd mechanism, the command argument is the name of the device
file corresponding to a file descriptor" -- that should probably
mention /proc/self/fd as well) but does not warn that it might
conflict with the "close all descriptors above 10" behavior.
The upshot is that the best way to learn is probably to ask somebody.
I don't think all these sorts of nuances are even covered by most
books on shell programming.
Messages sorted by: