feat(npm): functionality to support child_process.fork (#15891)

This commit is contained in:
David Sherret 2022-09-28 13:04:16 -04:00 committed by GitHub
parent 23125b275f
commit d677ba67f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 232 additions and 21 deletions

View file

@ -0,0 +1,3 @@
const chalk = require("chalk");
console.log(typeof chalk.green);

View file

@ -0,0 +1,19 @@
const path = require("path");
function childProcessFork(path) {
const p = Deno.run({
cmd: [Deno.execPath(), "run", "--unstable", "-A", path],
env: {
"DENO_DONT_USE_INTERNAL_NODE_COMPAT_STATE": Deno.core.ops.op_npm_process_state(),
}
});
p.status().then(() => {
console.log("Done.");
});
}
module.exports = {
run() {
childProcessFork(path.join(__dirname, "forked_path.js"));
}
};

View file

@ -0,0 +1,4 @@
{
"name": "@denotest/child-process-fork",
"version": "1.0.0"
}