zsh-workers
 help / color / mirror / code / Atom feed
* =(...) and clean-up on exit
@ 2016-09-14 13:48 Stephane Chazelas
  0 siblings, 0 replies; only message in thread
From: Stephane Chazelas @ 2016-09-14 13:48 UTC (permalink / raw)
  To: zsh-workers

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-09-14 13:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-14 13:48 =(...) and clean-up on exit Stephane Chazelas

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).