From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 10822 invoked from network); 8 Jun 2020 21:33:45 -0000 Received: from ns1.primenet.com.au (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with ESMTPUTF8; 8 Jun 2020 21:33:45 -0000 Received: (qmail 16968 invoked by alias); 8 Jun 2020 21:33:34 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 24912 Received: (qmail 5407 invoked by uid 1010); 8 Jun 2020 21:33:34 -0000 X-Qmail-Scanner-Diagnostics: from mail-oi1-f176.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.3/25835. spamassassin: 3.4.4. Clear:RC:0(209.85.167.176):SA:0(-1.9/5.0):. Processed in 2.002355 secs); 08 Jun 2020 21:33:34 -0000 X-Envelope-From: schaefer@brasslantern.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.167.176 as permitted sender) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=zWryNeuJR1i2+pXFxbV3R3hljSdxw1FYhMbBMxIPHGA=; b=EbsIFw0eAoISpwsddF34m3tzSiTu/OAiTDb17f6jZ/saePsKcg3FtL34VwoS4AOvNX y1GIXQAgqSwNq9VCGvWsj5GRf5OQoD3ulYdPAOL8fvLSou9XizRazF19wup6JV0sUYP2 XzG834qVOR0w3SEYS8z9gBr6CtdG61R6P9x+i4rbcra3eUFpXepzFmPjNhYVtUTD11g6 h4Kj6d0IreBNztknfSrWaerteEcJViimcqkVbcGtg2QwZt/sgRzfrLv98ZvlTdJyqX5D QwuV1R2DN5wutVoQkYEGw70Q8izBrKUIb6sgFIJ56T8dowuV0kH1XACK2FkhlHN4JagH mOeA== X-Gm-Message-State: AOAM533CESojhiPFc45cYf1pBjkexmpwOu+Q0vaAsad0aZqat2bTxUWc JRSGxffX8/zn537luXwlKy1NxulOFBzjiHwLscu4aQ== X-Google-Smtp-Source: ABdhPJxRTOWwoutVJXPl81usU+B9yuTV7ToBTjgekIk83lFOmDuZmmpFFr8gGL2lbmd0IUcBKlD6FTdODu05rOiAy+4= X-Received: by 2002:aca:a8c3:: with SMTP id r186mr1059082oie.173.1591651978744; Mon, 08 Jun 2020 14:32:58 -0700 (PDT) MIME-Version: 1.0 References: <20200606010018.5d9c4a33@tarpaulin.shahaf.local2> In-Reply-To: From: Bart Schaefer Date: Mon, 8 Jun 2020 14:32:47 -0700 Message-ID: Subject: Re: subprocess To: Pier Paolo Grassi Cc: Daniel Shahaf , Mikael Magnusson , Zsh-Users List Content-Type: text/plain; charset="UTF-8" On Mon, Jun 8, 2020 at 7:22 AM Pier Paolo Grassi 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.