aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-04-14 00:46:50 +0200
committerNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-09-14 11:04:35 +1000
commitcf1763dbb3c88a50171effb9be11954ee300de4d (patch)
treeb70a762fffec548535a6e0acee9f47bf517c6f3f /shell
parent22990b207b1ff9c636259dc494cf160fea2f476f (diff)
downloadbusybox-w32-cf1763dbb3c88a50171effb9be11954ee300de4d.tar.gz
busybox-w32-cf1763dbb3c88a50171effb9be11954ee300de4d.tar.bz2
busybox-w32-cf1763dbb3c88a50171effb9be11954ee300de4d.zip
win32: ash: shellexec
Diffstat (limited to 'shell')
-rw-r--r--shell/ash.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/shell/ash.c b/shell/ash.c
index d4bb3a55c..ed892db98 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -9423,6 +9423,20 @@ bltincmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
9423 * as POSIX mandates */ 9423 * as POSIX mandates */
9424 return back_exitstatus; 9424 return back_exitstatus;
9425} 9425}
9426
9427#if ENABLE_PLATFORM_MINGW32
9428static void
9429forkshell_shellexec(struct forkshell *fs)
9430{
9431 int idx = fs->fd[0];
9432 struct strlist *varlist = fs->strlist;
9433 char **argv = fs->argv;
9434 char *path = fs->string;
9435
9436 listsetvar(varlist, VEXPORT|VSTACK);
9437 shellexec(argv, path, idx);
9438}
9439#endif
9426static void 9440static void
9427evalcommand(union node *cmd, int flags) 9441evalcommand(union node *cmd, int flags)
9428{ 9442{
@@ -9599,6 +9613,26 @@ evalcommand(union node *cmd, int flags)
9599 } 9613 }
9600 } 9614 }
9601#endif 9615#endif
9616#if ENABLE_PLATFORM_MINGW32
9617 if (!(flags & EV_EXIT) || trap[0]) {
9618 struct forkshell fs;
9619
9620 memset(&fs, 0, sizeof(fs));
9621 fs.fp = forkshell_shellexec;
9622 fs.argv = argv;
9623 fs.string = (char*)path;
9624 fs.fd[0] = cmdentry.u.index;
9625 fs.strlist = varlist.list;
9626 jp = makejob(/*cmd,*/ 1);
9627 if (spawn_forkshell(jp, &fs, FORK_FG) < 0)
9628 ash_msg_and_raise_error("unable to spawn shell");
9629 exitstatus = waitforjob(jp);
9630 INT_ON;
9631 TRACE(("forked child exited with %d\n", exitstatus));
9632 break;
9633 }
9634 /* goes through to shellexec() */
9635#endif
9602 /* Fork off a child process if necessary. */ 9636 /* Fork off a child process if necessary. */
9603 if (!(flags & EV_EXIT) || trap[0]) { 9637 if (!(flags & EV_EXIT) || trap[0]) {
9604 INT_OFF; 9638 INT_OFF;
@@ -13310,6 +13344,7 @@ static const forkpoint_fn forkpoints[] = {
13310 forkshell_evalbackcmd, 13344 forkshell_evalbackcmd,
13311 forkshell_evalsubshell, 13345 forkshell_evalsubshell,
13312 forkshell_evalpipe, 13346 forkshell_evalpipe,
13347 forkshell_shellexec,
13313 NULL 13348 NULL
13314}; 13349};
13315 13350