Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
=(...) and clean-up on exit
- X-seq: zsh-workers 39319
- From: Stephane Chazelas <stephane.chazelas@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: =(...) and clean-up on exit
- Date: Wed, 14 Sep 2016 14:48:13 +0100
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author