mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-12-09 18:51:46 +01:00
Fixed a bug where the call to function "preexec" might pass the wrong
history line. Added two extra args to preexec to give the user more info on the command that is about to be executed.
This commit is contained in:
parent
ca3f1a3b79
commit
e3e22f715c
1 changed files with 9 additions and 1 deletions
10
Src/init.c
10
Src/init.c
|
|
@ -135,15 +135,23 @@ loop(int toplevel, int justonce)
|
|||
if (toplevel && (preprog = getshfunc("preexec")) != &dummy_eprog) {
|
||||
LinkList args;
|
||||
int osc = sfcontext;
|
||||
char *cmdstr;
|
||||
|
||||
args = znewlinklist();
|
||||
zaddlinknode(args, "preexec");
|
||||
if (hist_ring)
|
||||
/* If curline got dumped from the history, we don't know
|
||||
* what the user typed. */
|
||||
if (hist_ring && curline.histnum == curhist)
|
||||
zaddlinknode(args, hist_ring->text);
|
||||
else
|
||||
zaddlinknode(args, "");
|
||||
zaddlinknode(args, getjobtext(prog, NULL));
|
||||
zaddlinknode(args, cmdstr = getpermtext(prog, NULL));
|
||||
|
||||
sfcontext = SFC_HOOK;
|
||||
doshfunc("preexec", preprog, args, 0, 1);
|
||||
sfcontext = osc;
|
||||
zsfree(cmdstr);
|
||||
freelinklist(args, (FreeFunc) NULL);
|
||||
errflag = 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue