Hi, this is entry point of nodejs helper for building native modules: #!/usr/bin/env sh if [ "x$npm_config_node_gyp" = "x" ]; then node "`dirname "$0"`/../../node_modules/node-gyp/bin/node-gyp.js" "$@" else "$npm_config_node_gyp" "$@" fi
When running e.g. npm i -S better-sqlite3, it gets stuck: sh: exec if: No such file or directory ... Error: Cannot find module '/.../node_modules/integer/"`dirname' ... sh: exec else: No such file or directory sh: exec "$npm_config_node_gyp": No such file or directory sh: exec fi: No such file or directory Toybox toys/posix/env.c env_main() calls xexec() from lib/wrap.c, which has: // Only recurse to builtin when we have multiplexer and !vfork context. if (CFG_TOYBOX && !CFG_TOYBOX_NORECURSE && toys.stacktop && **argv != '/') toy_exec(argv); Is it clean to set toys.stacktop = 0 in env, so it runs my system shell? How to approach writing a test for this? --- >From 1ef072946aa860bfc0a762782ab4f82d4734b693 Mon Sep 17 00:00:00 2001 From: Denys Nykula <[email protected]> Date: Fri, 5 Jul 2019 14:27:24 +0000 Subject: [PATCH] Have env exec, not recurse to builtin. My app runs npm i -S better-sqlite3, and node-gyp-bin from the npm upstream has #!/usr/bin/env sh, expecting the system shell. --- toys/posix/env.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toys/posix/env.c b/toys/posix/env.c index 3a251334..01aa5ec4 100644 --- a/toys/posix/env.c +++ b/toys/posix/env.c @@ -44,7 +44,7 @@ void env_main(void) for (; *ev; ev++) if (strchr(*ev, '=')) xsetenv(xstrdup(*ev), 0); - else xexec(ev); + else toys.stacktop = 0, xexec(ev); for (ev = environ; *ev; ev++) xprintf("%s%c", *ev, '\n'*!FLAG(0)); } _______________________________________________ Toybox mailing list [email protected] http://lists.landley.net/listinfo.cgi/toybox-landley.net
