mirror of
git://git.code.sf.net/p/zsh/code
synced 2024-11-19 05:24:23 +01:00
19218: extend 19216 to zle widgets
This commit is contained in:
parent
d90e97e16a
commit
a7b9b5f851
@ -1,5 +1,8 @@
|
|||||||
2003-11-03 Peter Stephenson <pws@csr.com>
|
2003-11-03 Peter Stephenson <pws@csr.com>
|
||||||
|
|
||||||
|
* 19218: Src/exec.c, Src/Zle/zle_main.c: extend 19216 to
|
||||||
|
fix similar probably when calling zle widgets.
|
||||||
|
|
||||||
* 19216: Src/exec.c: save and restore $pipestatus on functions
|
* 19216: Src/exec.c: save and restore $pipestatus on functions
|
||||||
when noreturnval flag is set. Remove unnecessary debugging output.
|
when noreturnval flag is set. Remove unnecessary debugging output.
|
||||||
|
|
||||||
|
@ -910,7 +910,7 @@ execzlefunc(Thingy func, char **args)
|
|||||||
zsfree(msg);
|
zsfree(msg);
|
||||||
ret = 1;
|
ret = 1;
|
||||||
} else {
|
} else {
|
||||||
int osc = sfcontext, osi = movefd(0), olv = lastval;
|
int osc = sfcontext, osi = movefd(0);
|
||||||
int oxt = isset(XTRACE);
|
int oxt = isset(XTRACE);
|
||||||
LinkList largs = NULL;
|
LinkList largs = NULL;
|
||||||
|
|
||||||
@ -924,10 +924,8 @@ execzlefunc(Thingy func, char **args)
|
|||||||
makezleparams(0);
|
makezleparams(0);
|
||||||
sfcontext = SFC_WIDGET;
|
sfcontext = SFC_WIDGET;
|
||||||
opts[XTRACE] = 0;
|
opts[XTRACE] = 0;
|
||||||
doshfunc(w->u.fnnam, prog, largs, shf->flags, 0);
|
ret = doshfunc(w->u.fnnam, prog, largs, shf->flags, 1);
|
||||||
opts[XTRACE] = oxt;
|
opts[XTRACE] = oxt;
|
||||||
ret = lastval;
|
|
||||||
lastval = olv;
|
|
||||||
sfcontext = osc;
|
sfcontext = osc;
|
||||||
endparamscope();
|
endparamscope();
|
||||||
lastcmd = 0;
|
lastcmd = 0;
|
||||||
|
20
Src/exec.c
20
Src/exec.c
@ -3436,17 +3436,22 @@ loadautofn(Shfunc shf, int fksh, int autol)
|
|||||||
return shf;
|
return shf;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* execute a shell function */
|
/*
|
||||||
|
* execute a shell function
|
||||||
|
*
|
||||||
|
* If noreturnval is nonzero, then reset the current return
|
||||||
|
* value (lastval) to its value before the shell function
|
||||||
|
* was executed. However, in any case return the status value
|
||||||
|
* from the function (i.e. if noreturnval is not set, this
|
||||||
|
* will be the same as lastval).
|
||||||
|
*/
|
||||||
|
|
||||||
/**/
|
/**/
|
||||||
mod_export void
|
mod_export int
|
||||||
doshfunc(char *name, Eprog prog, LinkList doshargs, int flags, int noreturnval)
|
doshfunc(char *name, Eprog prog, LinkList doshargs, int flags, int noreturnval)
|
||||||
/* If noreturnval is nonzero, then reset the current return *
|
|
||||||
* value (lastval) to its value before the shell function *
|
|
||||||
* was executed. */
|
|
||||||
{
|
{
|
||||||
char **tab, **x, *oargv0;
|
char **tab, **x, *oargv0;
|
||||||
int oldzoptind, oldlastval, oldoptcind, oldnumpipestats;
|
int oldzoptind, oldlastval, oldoptcind, oldnumpipestats, ret;
|
||||||
int *oldpipestats = NULL;
|
int *oldpipestats = NULL;
|
||||||
char saveopts[OPT_SIZE], *oldscriptname = scriptname, *fname = dupstring(name);
|
char saveopts[OPT_SIZE], *oldscriptname = scriptname, *fname = dupstring(name);
|
||||||
int obreaks;
|
int obreaks;
|
||||||
@ -3577,6 +3582,7 @@ doshfunc(char *name, Eprog prog, LinkList doshargs, int flags, int noreturnval)
|
|||||||
|
|
||||||
if (trapreturn < -1)
|
if (trapreturn < -1)
|
||||||
trapreturn++;
|
trapreturn++;
|
||||||
|
ret = lastval;
|
||||||
if (noreturnval) {
|
if (noreturnval) {
|
||||||
lastval = oldlastval;
|
lastval = oldlastval;
|
||||||
numpipestats = oldnumpipestats;
|
numpipestats = oldnumpipestats;
|
||||||
@ -3599,6 +3605,8 @@ doshfunc(char *name, Eprog prog, LinkList doshargs, int flags, int noreturnval)
|
|||||||
zexit(exit_pending >> 1, 0);
|
zexit(exit_pending >> 1, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This finally executes a shell function and any function wrappers *
|
/* This finally executes a shell function and any function wrappers *
|
||||||
|
Loading…
Reference in New Issue
Block a user