Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swap emulator Node runtime discovery to favor local cache #2740

Merged
merged 12 commits into from
Oct 28, 2020
Next Next commit
Fixes passing flags to firepit node shim
  • Loading branch information
abeisgoat committed Jun 2, 2020
commit b7fb7448afe3bdafaf6d1f48800a994e5c9f528f
34 changes: 25 additions & 9 deletions standalone/runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,32 @@
"--foo" argument.
*/
exports.Script_NodeJS = function() {
const [script, ...otherArgs] = process.argv.slice(2);
const execArgv = [];
let script = "";
const scriptArgv = [];

process.argv.slice(2).forEach((arg) => {
if (!script) {
if (arg.startsWith("--")) {
execArgv.push(arg);
} else {
script = arg;
}
} else {
scriptArgv.push(arg);
}
});

require("child_process")
.fork(script, otherArgs, {
env: process.env,
cwd: process.cwd(),
stdio: "inherit"
})
.on("exit", code => {
process.exit(code);
});
.fork(script, scriptArgv, {
env: process.env,
cwd: process.cwd(),
stdio: "inherit",
execArgv
})
.on("exit", code => {
process.exit(code);
});
};

/*
Expand Down