diff options
Diffstat (limited to 'shell/ash.c')
-rw-r--r-- | shell/ash.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/shell/ash.c b/shell/ash.c index 2d2368bc8..083903486 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -7766,13 +7766,21 @@ evalcase(union node *n, int flags) | |||
7766 | static void | 7766 | static void |
7767 | evalsubshell(union node *n, int flags) | 7767 | evalsubshell(union node *n, int flags) |
7768 | { | 7768 | { |
7769 | #ifndef __MINGW32__ | ||
7769 | struct job *jp; | 7770 | struct job *jp; |
7771 | #endif | ||
7770 | int backgnd = (n->type == NBACKGND); | 7772 | int backgnd = (n->type == NBACKGND); |
7771 | int status; | 7773 | int status; |
7772 | 7774 | ||
7773 | expredir(n->nredir.redirect); | 7775 | expredir(n->nredir.redirect); |
7774 | if (!backgnd && flags & EV_EXIT && !trap[0]) | 7776 | if (!backgnd && flags & EV_EXIT && !trap[0]) { |
7775 | goto nofork; | 7777 | redirect(n->nredir.redirect, 0); |
7778 | evaltreenr(n->nredir.n, flags); | ||
7779 | } else { | ||
7780 | #ifdef __MINGW32__ | ||
7781 | status = forkshell("evalsubshell", n, backgnd ? (flags | EV_EXIT | EV_TESTED) : (flags | EV_EXIT)); | ||
7782 | } | ||
7783 | #else | ||
7776 | INT_OFF; | 7784 | INT_OFF; |
7777 | jp = makejob(n, 1); | 7785 | jp = makejob(n, 1); |
7778 | if (forkshell(jp, n, backgnd) == 0) { | 7786 | if (forkshell(jp, n, backgnd) == 0) { |
@@ -7780,14 +7788,15 @@ evalsubshell(union node *n, int flags) | |||
7780 | flags |= EV_EXIT; | 7788 | flags |= EV_EXIT; |
7781 | if (backgnd) | 7789 | if (backgnd) |
7782 | flags &=~ EV_TESTED; | 7790 | flags &=~ EV_TESTED; |
7783 | nofork: | ||
7784 | redirect(n->nredir.redirect, 0); | 7791 | redirect(n->nredir.redirect, 0); |
7785 | evaltreenr(n->nredir.n, flags); | 7792 | evaltreenr(n->nredir.n, flags); |
7786 | /* never returns */ | 7793 | /* never returns */ |
7787 | } | 7794 | } |
7795 | } | ||
7788 | status = 0; | 7796 | status = 0; |
7789 | if (! backgnd) | 7797 | if (! backgnd) |
7790 | status = waitforjob(jp); | 7798 | status = waitforjob(jp); |
7799 | #endif | ||
7791 | exitstatus = status; | 7800 | exitstatus = status; |
7792 | INT_ON; | 7801 | INT_ON; |
7793 | } | 7802 | } |