diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2010-04-14 00:46:12 +0200 |
---|---|---|
committer | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2010-04-20 19:14:52 +0200 |
commit | a2bcc7d62fee2e530ca150d7f185f122887608e8 (patch) | |
tree | 054876a3b26b1aed06d3bb1222a89b206fbc1d2c /shell | |
parent | 1d847e4b4dfa1699d7b65434ec75546791de4b96 (diff) | |
download | busybox-w32-a2bcc7d62fee2e530ca150d7f185f122887608e8.tar.gz busybox-w32-a2bcc7d62fee2e530ca150d7f185f122887608e8.tar.bz2 busybox-w32-a2bcc7d62fee2e530ca150d7f185f122887608e8.zip |
win32: ash: evalsubshell
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ash.c | 26 |
1 files changed, 26 insertions, 0 deletions
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) | |||
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 | ||
8786 | static void | ||
8787 | forkshell_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 | ||
8785 | static void | 8801 | static void |
8786 | evalsubshell(union node *n, int flags) | 8802 | evalsubshell(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; |
@@ -13245,6 +13270,7 @@ extern int etext(); | |||
13245 | static const forkpoint_fn forkpoints[] = { | 13270 | static const forkpoint_fn forkpoints[] = { |
13246 | forkshell_openhere, | 13271 | forkshell_openhere, |
13247 | forkshell_evalbackcmd, | 13272 | forkshell_evalbackcmd, |
13273 | forkshell_evalsubshell, | ||
13248 | NULL | 13274 | NULL |
13249 | }; | 13275 | }; |
13250 | 13276 | ||