diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2010-04-14 00:46:50 +0200 |
---|---|---|
committer | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2010-04-20 19:14:53 +0200 |
commit | 536a13a396fc7e3c0648a5ab23ddbf04ef72fd0d (patch) | |
tree | 00bd76f880d19887e22a3d26f7b20d4683a5eb13 /shell | |
parent | 058c79758d5fbee56e7849499a3e6ab4fba00600 (diff) | |
download | busybox-w32-536a13a396fc7e3c0648a5ab23ddbf04ef72fd0d.tar.gz busybox-w32-536a13a396fc7e3c0648a5ab23ddbf04ef72fd0d.tar.bz2 busybox-w32-536a13a396fc7e3c0648a5ab23ddbf04ef72fd0d.zip |
win32: ash: shellexec
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ash.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/shell/ash.c b/shell/ash.c index c80c1411d..1f8f85639 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 | ||
9428 | static void | ||
9429 | forkshell_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 | ||
9426 | static void | 9440 | static void |
9427 | evalcommand(union node *cmd, int flags) | 9441 | evalcommand(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; |
@@ -13309,6 +13343,7 @@ static const forkpoint_fn forkpoints[] = { | |||
13309 | forkshell_evalbackcmd, | 13343 | forkshell_evalbackcmd, |
13310 | forkshell_evalsubshell, | 13344 | forkshell_evalsubshell, |
13311 | forkshell_evalpipe, | 13345 | forkshell_evalpipe, |
13346 | forkshell_shellexec, | ||
13312 | NULL | 13347 | NULL |
13313 | }; | 13348 | }; |
13314 | 13349 | ||