• R/O
  • SSH
  • HTTPS

yash: Commit


Commit MetaInfo

Revision4141 (tree)
Time2020-11-05 20:58:02
Authormagicant

Log Message

Assign before redirect in command w/o word (#39287, 40842)

Change Summary

Incremental Difference

--- yash/trunk/exec.c (revision 4140)
+++ yash/trunk/exec.c (revision 4141)
@@ -689,32 +689,27 @@
689689 * Returns true if the shell should exit. */
690690 bool exec_simple_command_without_words(const command_T *c)
691691 {
692- bool finally_exit = false;
692+ /* perform assignments */
693+ bool ok = do_assignments(c->c_assigns, false, shopt_allexport);
694+ print_xtrace(NULL);
695+ last_assign = c->c_assigns;
696+ if (!ok) {
697+ laststatus = Exit_ASSGNERR;
698+ return !is_interactive_now;
699+ }
693700
694701 /* open redirections */
695702 savefd_T *savefd;
696- if (!open_redirections(c->c_redirs, &savefd)) {
703+ ok = open_redirections(c->c_redirs, &savefd);
704+ undo_redirections(savefd);
705+ if (ok) {
706+ laststatus = lastcmdsubstatus;
707+ } else {
697708 laststatus = Exit_REDIRERR;
698709 apply_errexit_errreturn(NULL);
699- goto done;
700710 }
701711
702- /* perform assignments */
703- last_assign = c->c_assigns;
704- if (do_assignments(c->c_assigns, false, shopt_allexport)) {
705- laststatus = lastcmdsubstatus;
706- } else {
707- laststatus = Exit_ASSGNERR;
708- if (!is_interactive_now)
709- finally_exit = true;
710- }
711- print_xtrace(NULL);
712-
713- /* cleanup */
714-done:
715- undo_redirections(savefd);
716-
717- return finally_exit;
712+ return false;
718713 }
719714
720715 /* Executes the simple command that has one or more expanded words.
Show on old repository browser