Node.js - Child Processes
You wrote this code to spawn a child process and listen for exit:
But the console never logs anything. What is the likely problem?
const { spawn } = require('child_process');
const child = spawn('node', ['-e', "setTimeout(() => process.exit(0), 1000)"]);
child.unref();
child.on('exit', (code) => {
console.log(`Exited with code ${code}`);
});But the console never logs anything. What is the likely problem?
