diff options
author | Peter Stephenson <pws@zsh.org> | 2015-04-28 09:22:37 +0100 |
---|---|---|
committer | Peter Stephenson <pws@zsh.org> | 2015-04-28 09:22:37 +0100 |
commit | df5115a741561d251b30926ce09486737da1e8da (patch) | |
tree | 63a3b48d8129aba8b841b2748bfa0bf5a1cc7e0b /Src/exec.c | |
parent | 9f9a16f43c5c66d3a764ef2abaacca6a3d91f89c (diff) | |
download | zsh-df5115a741561d251b30926ce09486737da1e8da.tar.gz zsh-df5115a741561d251b30926ce09486737da1e8da.tar.xz zsh-df5115a741561d251b30926ce09486737da1e8da.zip |
34979: Preserve job text when doing shell job fix.
This handles list_pipe_text in execlist() along with other variables that are saved and restored and, in the special case of source, cleared.
Diffstat (limited to 'Src/exec.c')
-rw-r--r-- | Src/exec.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/Src/exec.c b/Src/exec.c index 60b79c6ea..31c80a74e 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -1147,6 +1147,7 @@ execlist(Estate state, int dont_change_job, int exiting) wordcode code; int ret, cj, csp, ltype; int old_pline_level, old_list_pipe, old_list_pipe_job; + char *old_list_pipe_text; zlong oldlineno; /* * ERREXIT only forces the shell to exit if the last command in a && @@ -1160,10 +1161,16 @@ execlist(Estate state, int dont_change_job, int exiting) old_pline_level = pline_level; old_list_pipe = list_pipe; old_list_pipe_job = list_pipe_job; + if (*list_pipe_text) + old_list_pipe_text = ztrdup(list_pipe_text); + else + old_list_pipe_text = NULL; oldlineno = lineno; - if (sourcelevel && unset(SHINSTDIN)) + if (sourcelevel && unset(SHINSTDIN)) { pline_level = list_pipe = list_pipe_job = 0; + *list_pipe_text = '\0'; + } /* Loop over all sets of comands separated by newline, * * semi-colon or ampersand (`sublists'). */ @@ -1399,6 +1406,12 @@ sublist_done: pline_level = old_pline_level; list_pipe = old_list_pipe; list_pipe_job = old_list_pipe_job; + if (old_list_pipe_text) { + strcpy(list_pipe_text, old_list_pipe_text); + zsfree(old_list_pipe_text); + } else { + *list_pipe_text = '\0'; + } lineno = oldlineno; if (dont_change_job) thisjob = cj; |