From a2bcc7d62fee2e530ca150d7f185f122887608e8 Mon Sep 17 00:00:00 2001 From: Nguyễn Thái Ngọc Duy Date: Wed, 14 Apr 2010 00:46:12 +0200 Subject: win32: ash: evalsubshell MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nguyễn Thái Ngọc Duy --- shell/ash.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'shell') diff --git a/shell/ash.c b/shell/ash.c index 2b9b2226e..a1bfd90f1 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -8782,9 +8782,26 @@ evalcase(union node *n, int flags) /* * Kick off a subshell to evaluate a tree. */ +#if ENABLE_PLATFORM_MINGW32 +static void +forkshell_evalsubshell(struct forkshell *fs) +{ + union node *n = fs->n; + int flags = fs->flags; + + TRACE(("ash: subshell: %s\n",__PRETTY_FUNCTION__)); + INT_ON; + flags |= EV_EXIT; + expredir(n->nredir.redirect); + redirect(n->nredir.redirect, 0); + evaltreenr(n->nredir.n, flags); + /* never returns */ +} +#endif static void evalsubshell(union node *n, int flags) { + IF_PLATFORM_MINGW32(struct forkshell fs); struct job *jp; int backgnd = (n->type == NBACKGND); int status; @@ -8794,6 +8811,14 @@ evalsubshell(union node *n, int flags) goto nofork; INT_OFF; jp = makejob(/*n,*/ 1); +#if ENABLE_PLATFORM_MINGW32 + memset(&fs, 0, sizeof(fs)); + fs.fp = forkshell_evalsubshell; + fs.n = n; + fs.flags = flags; + if (spawn_forkshell(jp, &fs, backgnd) < 0) + ash_msg_and_raise_error("unable to spawn shell"); +#endif if (forkshell(jp, n, backgnd) == 0) { INT_ON; flags |= EV_EXIT; @@ -13245,6 +13270,7 @@ extern int etext(); static const forkpoint_fn forkpoints[] = { forkshell_openhere, forkshell_evalbackcmd, + forkshell_evalsubshell, NULL }; -- cgit v1.2.3-55-g6feb