fixes to tmpfile scoping

This commit is contained in:
Jaromil 2015-03-22 10:30:24 +01:00
parent 4b542abc04
commit cb7517e678
1 changed files with 6 additions and 4 deletions

10
zuper
View File

@ -24,7 +24,7 @@
##########################
typeset -aU vars
typeset -aU arrs
vars=(debug quiet)
vars=(debug quiet ztmpfile)
arrs=()
debug=${debug:-0}
@ -219,14 +219,16 @@ endgame() {
##########################
# Temp file handling
# ztmp() fills in $ztmpfile global. Caller must copy that variable as
# it will be overwritten at every call.
ztmp() {
fn ztmp
_tmp=`mktemp`
tmpfiles+=($_tmp)
print $_tmp
ztmpfile=`mktemp`
tmpfiles+=($ztmpfile)
}
# All tempfiles are freed in endgame()
_ztmp_destructor() {
fn _ztmp_destructor