From 3c5995713d91df7b6f803b34e43df188646b0676 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Mon, 1 Jun 2020 08:43:17 +0100 Subject: ash: simplify spawning during forkshell spawn_forkshell() uses mingw_spawn_proc() to start the child shell. mingw_spawn_proc() then calls mingw_spawn_1() which determines that "sh" is an applet, thus calling mingw_spawn_applet() which finally calls spawnveq(). Not only is this convoluted it also won't work if PREFER_APPLETS and SH_STANDALONE aren't enabled. Simplify matters by adding a new function, mingw_spawn_forkshell(), which is tailored for just this case. --- win32/process.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'win32') diff --git a/win32/process.c b/win32/process.c index d33f06405..04775100b 100644 --- a/win32/process.c +++ b/win32/process.c @@ -391,6 +391,15 @@ mingw_spawn_proc(const char **argv) return mingw_spawn_1(P_NOWAIT, argv[0], (char *const *)argv, environ); } +#if ENABLE_ASH || ENABLE_SH_IS_ASH || ENABLE_BASH_IS_ASH +intptr_t FAST_FUNC +mingw_spawn_forkshell(const char **argv) +{ + return spawnveq(P_NOWAIT, bb_busybox_exec_path, (char *const *)argv, + environ); +} +#endif + int mingw_execvp(const char *cmd, char *const *argv) { -- cgit v1.2.3-55-g6feb