1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-05-20 23:41:27 +02:00

52482: strip trailing newlines in emulation modes of ${ command; }

This commit is contained in:
Bart Schaefer 2024-01-24 17:56:21 -08:00
parent 0fccdf0d57
commit b3e763cc22
2 changed files with 9 additions and 0 deletions

View file

@ -1,5 +1,8 @@
2024-01-24 Bart Schaefer <schaefer@zsh.org>
* 52482: Src/subst.c: strip trailing newlines in emulation modes
of ${ command; }, for bash/ksh compatibility
* 52476 + cf. 52479: Etc/FAQ.yo: more about nofork substitution
* 52477: Src/Modules/curses.c: fix "zcurses mouse delay ..."

View file

@ -2005,6 +2005,12 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
int onoerrs = noerrs, rplylen;
noerrs = 2;
rplylen = zstuff(&cmdarg, rplytmp);
if (! EMULATION(EMULATE_ZSH)) {
/* bash and ksh strip trailing newlines here */
while (rplylen > 0 && cmdarg[rplylen-1] == '\n')
rplylen--;
cmdarg[rplylen] = 0;
}
noerrs = onoerrs;
if (rplylen >= 0)
setsparam("REPLY", metafy(cmdarg, rplylen, META_REALLOC));