From: Stephane Chazelas <stephane.chazelas@gmail.com>
To: zsh-workers@zsh.org
Subject: =(...) and clean-up on exit
Date: Wed, 14 Sep 2016 14:48:13 +0100 [thread overview]
Message-ID: <20160914134813.GA13885@chaz.gmail.com> (raw)
zsh does clean-up the tempfile in:
() (echo $1; exit) =(:)
() (exec echo $1) =(:)
but not in:
$ ( () { echo $1; exit; } =(:) )
/tmp/zshcnGWVU
$ ls /tmp/zshcnGWVU
/tmp/zshcnGWVU
$ ( () { exec echo $1; } =(:) )
/tmp/zshK11SXc
$ ls -d /tmp/zshK11SXc
/tmp/zshK11SXc
$ zsh -c 'exec echo =(:)'
/tmp/zshX6WCf1
$ ls -d /tmp/zshX6WCf1
/tmp/zshX6WCf1
While not much can be done in the 3rd case and doing something
would be cumbersome at best in the 2nd case (like the subshell
communicating to its parent the list of temp files to clean up),
the first one might be more easily doable?
In any case the current zsh behaviour is already better than in
ksh93's ">;" where it's not handled at all:
$ ksh93 -c '(readlink /dev/fd/3; exit) 3>; x'
/home/chazelas/.<#d_19036{;.tmp
$ ls -d '/home/chazelas/.<#d_19036{;.tmp'
/home/chazelas/.<#d_19036{;.tmp
Or bash on systems that don't have /dev/fd as it seems not to
clean up the temporary named pipes at all(!):
$ bash -c '/bin/echo <(:); echo test'
/tmp/sh-np-1012032307
test
$ ls /tmp/sh-np-1012032307
/tmp/sh-np-1012032307
--
Stephane
reply other threads:[~2016-09-14 13:50 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20160914134813.GA13885@chaz.gmail.com \
--to=stephane.chazelas@gmail.com \
--cc=zsh-workers@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).