1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-12-11 19:31:21 +01:00

39507: TMPSUFFIX for =(...)

This commit is contained in:
Barton E. Schaefer 2016-09-29 14:55:49 -07:00
parent e61ed2b80d
commit 736eb433ba
3 changed files with 20 additions and 0 deletions

View file

@ -1,5 +1,7 @@
2016-09-29 Barton E. Schaefer <schaefer@zsh.org> 2016-09-29 Barton E. Schaefer <schaefer@zsh.org>
* 39507: Doc/Zsh/params.yo, Src/exec.c: TMPSUFFIX for =(...)
* 39470: Src/exec.c, Src/utils.c: failure to open a supposedly * 39470: Src/exec.c, Src/utils.c: failure to open a supposedly
unique temp file name should result in an error; band-aid for unique temp file name should result in an error; band-aid for
signal-related race conditions in temp file name generation signal-related race conditions in temp file name generation

View file

@ -1547,6 +1547,15 @@ A pathname prefix which the shell will use for all temporary files.
Note that this should include an initial part for the file name as Note that this should include an initial part for the file name as
well as any directory names. The default is `tt(/tmp/zsh)'. well as any directory names. The default is `tt(/tmp/zsh)'.
) )
vindex(TMPSUFFIX)
item(tt(TMPSUFFIX))(
A filename suffix which the shell will use for temporary files created
by process substitutions (e.g., `tt(=LPAR()var(list)RPAR())').
Note that the value should include a leading dot `tt(.)' if intended
to be interpreted as a file extension. The default is not to append
any suffix, thus this parameter should be assigned only when needed
and then unset again.
)
vindex(watch) vindex(watch)
vindex(WATCH) vindex(WATCH)
item(tt(watch) <S> <Z> (tt(WATCH) <S>))( item(tt(watch) <S> <Z> (tt(WATCH) <S>))(

View file

@ -4421,6 +4421,15 @@ getoutputfile(char *cmd, char **eptr)
if (!s) if (!s)
child_unblock(); child_unblock();
return NULL; return NULL;
} else {
char *suffix = getsparam("TMPSUFFIX");
if (suffix && *suffix && !strstr(suffix, "/")) {
suffix = dyncat(nam, unmeta(suffix));
if (link(nam, suffix) == 0) {
addfilelist(nam, 0);
nam = ztrdup(suffix);
}
}
} }
addfilelist(nam, 0); addfilelist(nam, 0);