mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-12 01:11:27 +02:00
zsh-workers/10197
This commit is contained in:
parent
626e2aeb16
commit
73ca2634cf
2 changed files with 22 additions and 0 deletions
13
Src/exec.c
13
Src/exec.c
|
@ -2672,7 +2672,9 @@ getoutput(char *cmd, int qt)
|
||||||
redup(pipes[1], 1);
|
redup(pipes[1], 1);
|
||||||
opts[MONITOR] = 0;
|
opts[MONITOR] = 0;
|
||||||
entersubsh(Z_SYNC, 1, 0);
|
entersubsh(Z_SYNC, 1, 0);
|
||||||
|
cmdpush(CS_CMDSUBST);
|
||||||
execode(prog, 0, 1);
|
execode(prog, 0, 1);
|
||||||
|
cmdpop();
|
||||||
close(1);
|
close(1);
|
||||||
_exit(lastval);
|
_exit(lastval);
|
||||||
zerr("exit returned in child!!", NULL, 0);
|
zerr("exit returned in child!!", NULL, 0);
|
||||||
|
@ -2801,7 +2803,9 @@ getoutputfile(char *cmd)
|
||||||
redup(fd, 1);
|
redup(fd, 1);
|
||||||
opts[MONITOR] = 0;
|
opts[MONITOR] = 0;
|
||||||
entersubsh(Z_SYNC, 1, 0);
|
entersubsh(Z_SYNC, 1, 0);
|
||||||
|
cmdpush(CS_CMDSUBST);
|
||||||
execode(prog, 0, 1);
|
execode(prog, 0, 1);
|
||||||
|
cmdpop();
|
||||||
close(1);
|
close(1);
|
||||||
_exit(lastval);
|
_exit(lastval);
|
||||||
zerr("exit returned in child!!", NULL, 0);
|
zerr("exit returned in child!!", NULL, 0);
|
||||||
|
@ -2885,7 +2889,9 @@ getproc(char *cmd)
|
||||||
redup(pipes[out], out);
|
redup(pipes[out], out);
|
||||||
closem(0); /* this closes pipes[!out] as well */
|
closem(0); /* this closes pipes[!out] as well */
|
||||||
#endif
|
#endif
|
||||||
|
cmdpush(CS_CMDSUBST);
|
||||||
execode(prog, 0, 1);
|
execode(prog, 0, 1);
|
||||||
|
cmdpop();
|
||||||
zclose(out);
|
zclose(out);
|
||||||
_exit(lastval);
|
_exit(lastval);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -2911,7 +2917,9 @@ getpipe(char *cmd)
|
||||||
entersubsh(Z_ASYNC, 1, 0);
|
entersubsh(Z_ASYNC, 1, 0);
|
||||||
redup(pipes[out], out);
|
redup(pipes[out], out);
|
||||||
closem(0); /* this closes pipes[!out] as well */
|
closem(0); /* this closes pipes[!out] as well */
|
||||||
|
cmdpush(CS_CMDSUBST);
|
||||||
execode(prog, 0, 1);
|
execode(prog, 0, 1);
|
||||||
|
cmdpop();
|
||||||
_exit(lastval);
|
_exit(lastval);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2963,7 +2971,9 @@ execcond(Estate state, int do_exec)
|
||||||
fprintf(xtrerr, "[[");
|
fprintf(xtrerr, "[[");
|
||||||
tracingcond++;
|
tracingcond++;
|
||||||
}
|
}
|
||||||
|
cmdpush(CS_COND);
|
||||||
stat = !evalcond(state);
|
stat = !evalcond(state);
|
||||||
|
cmdpop();
|
||||||
if (isset(XTRACE)) {
|
if (isset(XTRACE)) {
|
||||||
fprintf(xtrerr, " ]]\n");
|
fprintf(xtrerr, " ]]\n");
|
||||||
fflush(xtrerr);
|
fflush(xtrerr);
|
||||||
|
@ -2986,6 +2996,7 @@ execarith(Estate state, int do_exec)
|
||||||
printprompt4();
|
printprompt4();
|
||||||
fprintf(xtrerr, "((");
|
fprintf(xtrerr, "((");
|
||||||
}
|
}
|
||||||
|
cmdpush(CS_MATH);
|
||||||
e = ecgetstr(state, EC_DUPTOK, &htok);
|
e = ecgetstr(state, EC_DUPTOK, &htok);
|
||||||
if (htok)
|
if (htok)
|
||||||
singsub(&e);
|
singsub(&e);
|
||||||
|
@ -2994,6 +3005,8 @@ execarith(Estate state, int do_exec)
|
||||||
|
|
||||||
val = mathevali(e);
|
val = mathevali(e);
|
||||||
|
|
||||||
|
cmdpop();
|
||||||
|
|
||||||
if (isset(XTRACE)) {
|
if (isset(XTRACE)) {
|
||||||
fprintf(xtrerr, " ))\n");
|
fprintf(xtrerr, " ))\n");
|
||||||
fflush(xtrerr);
|
fflush(xtrerr);
|
||||||
|
|
|
@ -904,6 +904,8 @@ source(char *s)
|
||||||
int oldshst, osubsh, oloops;
|
int oldshst, osubsh, oloops;
|
||||||
FILE *obshin;
|
FILE *obshin;
|
||||||
char *old_scriptname = scriptname, *us;
|
char *old_scriptname = scriptname, *us;
|
||||||
|
char *ocs;
|
||||||
|
int ocsp;
|
||||||
|
|
||||||
if (!s ||
|
if (!s ||
|
||||||
(!(prog = try_source_file((us = unmeta(s)))) &&
|
(!(prog = try_source_file((us = unmeta(s)))) &&
|
||||||
|
@ -919,6 +921,10 @@ source(char *s)
|
||||||
oldlineno = lineno; /* store our current lineno */
|
oldlineno = lineno; /* store our current lineno */
|
||||||
oloops = loops; /* stored the # of nested loops we are in */
|
oloops = loops; /* stored the # of nested loops we are in */
|
||||||
oldshst = opts[SHINSTDIN]; /* store current value of this option */
|
oldshst = opts[SHINSTDIN]; /* store current value of this option */
|
||||||
|
ocs = cmdstack;
|
||||||
|
ocsp = cmdsp;
|
||||||
|
cmdstack = (unsigned char *) zalloc(CMDSTACKSZ);
|
||||||
|
cmdsp = 0;
|
||||||
|
|
||||||
if (!prog) {
|
if (!prog) {
|
||||||
SHIN = tempfd;
|
SHIN = tempfd;
|
||||||
|
@ -957,6 +963,9 @@ source(char *s)
|
||||||
errflag = 0;
|
errflag = 0;
|
||||||
retflag = 0;
|
retflag = 0;
|
||||||
scriptname = old_scriptname;
|
scriptname = old_scriptname;
|
||||||
|
free(cmdstack);
|
||||||
|
cmdstack = ocs;
|
||||||
|
cmdsp = ocsp;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue