• R/O
  • SSH
  • HTTPS

yash: Commit


Commit MetaInfo

Revision3937 (tree)
Time2018-12-09 00:26:00
Authormagicant

Log Message

Simple refactoring in exec_process

Change Summary

Incremental Difference

--- yash/trunk/exec.c (revision 3936)
+++ yash/trunk/exec.c (revision 3937)
@@ -784,7 +784,6 @@
784784 pid_t exec_process(
785785 command_T *restrict c, exec_T type, pipeinfo_T *restrict pi, pid_t pgid)
786786 {
787- bool early_fork; /* do early fork? */
788787 bool finally_exit; /* never return? */
789788 int argc;
790789 void **argv = NULL;
@@ -795,16 +794,16 @@
795794
796795 /* fork first if `type' is E_ASYNC, the command type is subshell,
797796 * or there is a pipe. */
798- early_fork = (type != E_SELF)
799- && (type == E_ASYNC || c->c_type == CT_SUBSHELL
800- || pi->pi_fromprevfd >= 0 || pi->pi_tonextfds[PIPE_OUT] >= 0);
801797 finally_exit = (type == E_SELF);
802- if (early_fork) {
803- sigtype_T sigtype = (type == E_ASYNC) ? t_quitint : 0;
804- cpid = fork_and_reset(pgid, type == E_NORMAL, sigtype);
805- if (cpid != 0)
806- goto done;
807- finally_exit = true;
798+ if (!finally_exit) {
799+ if (type == E_ASYNC || c->c_type == CT_SUBSHELL
800+ || pi->pi_fromprevfd >= 0 || pi->pi_tonextfds[PIPE_OUT] >= 0) {
801+ sigtype_T sigtype = (type == E_ASYNC) ? t_quitint : 0;
802+ cpid = fork_and_reset(pgid, type == E_NORMAL, sigtype);
803+ if (cpid != 0)
804+ goto done;
805+ finally_exit = true;
806+ }
808807 }
809808
810809 lastcmdsubstatus = Exit_SUCCESS;
@@ -903,7 +902,8 @@
903902
904903 /* create a child process to execute the external command */
905904 if (cmdinfo.type == CT_EXTERNALPROGRAM && !finally_exit) {
906- cpid = fork_and_reset(pgid, type == E_NORMAL, t_leave);
905+ assert(type == E_NORMAL);
906+ cpid = fork_and_reset(pgid, true, t_leave);
907907 if (cpid != 0)
908908 goto done3;
909909 finally_exit = true;
Show on old repository browser