node --expose_gc ./wrapper.js ./payload.js
Expected:
[Function: gc] true
[Function: gc]
Actual (v15.5.1)
[Function: gc] true
undefined
| const cluster = require("cluster"); | |
| if (cluster.isMaster) { | |
| console.log(globalThis.gc, cluster.isMaster); | |
| cluster.fork(); | |
| } else { | |
| console.log(globalThis.gc); | |
| process.kill(process.pid); | |
| } |
| #!/usr/bin/env node | |
| const { isAbsolute, join } = require("path"); | |
| const args = process.argv[process.argv.length - 1]; | |
| const filename = args[0]; | |
| if (!isAbsolute(filename)) { | |
| args[0] = join(process.cwd(), filename); | |
| } | |
| process.argv = ["node"].concat(args); | |
| process.execArgv.unshift(__filename); | |
| require("module").runMain(); |