aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--shell/ash.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 5341ef75f..863158a6a 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -8782,9 +8782,26 @@ evalcase(union node *n, int flags)
8782/* 8782/*
8783 * Kick off a subshell to evaluate a tree. 8783 * Kick off a subshell to evaluate a tree.
8784 */ 8784 */
8785#if ENABLE_PLATFORM_MINGW32
8786static void
8787forkshell_evalsubshell(struct forkshell *fs)
8788{
8789 union node *n = fs->n;
8790 int flags = fs->flags;
8791
8792 TRACE(("ash: subshell: %s\n",__PRETTY_FUNCTION__));
8793 INT_ON;
8794 flags |= EV_EXIT;
8795 expredir(n->nredir.redirect);
8796 redirect(n->nredir.redirect, 0);
8797 evaltreenr(n->nredir.n, flags);
8798 /* never returns */
8799}
8800#endif
8785static void 8801static void
8786evalsubshell(union node *n, int flags) 8802evalsubshell(union node *n, int flags)
8787{ 8803{
8804 IF_PLATFORM_MINGW32(struct forkshell fs);
8788 struct job *jp; 8805 struct job *jp;
8789 int backgnd = (n->type == NBACKGND); 8806 int backgnd = (n->type == NBACKGND);
8790 int status; 8807 int status;
@@ -8794,6 +8811,14 @@ evalsubshell(union node *n, int flags)
8794 goto nofork; 8811 goto nofork;
8795 INT_OFF; 8812 INT_OFF;
8796 jp = makejob(/*n,*/ 1); 8813 jp = makejob(/*n,*/ 1);
8814#if ENABLE_PLATFORM_MINGW32
8815 memset(&fs, 0, sizeof(fs));
8816 fs.fp = forkshell_evalsubshell;
8817 fs.n = n;
8818 fs.flags = flags;
8819 if (spawn_forkshell(jp, &fs, backgnd) < 0)
8820 ash_msg_and_raise_error("unable to spawn shell");
8821#endif
8797 if (forkshell(jp, n, backgnd) == 0) { 8822 if (forkshell(jp, n, backgnd) == 0) {
8798 INT_ON; 8823 INT_ON;
8799 flags |= EV_EXIT; 8824 flags |= EV_EXIT;
@@ -13246,6 +13271,7 @@ extern int etext();
13246static const forkpoint_fn forkpoints[] = { 13271static const forkpoint_fn forkpoints[] = {
13247 forkshell_openhere, 13272 forkshell_openhere,
13248 forkshell_evalbackcmd, 13273 forkshell_evalbackcmd,
13274 forkshell_evalsubshell,
13249 NULL 13275 NULL
13250}; 13276};
13251 13277