Performance: Child process exit codes
MEDIUM IMPACT
This concept affects how efficiently a Node.js application handles subprocess termination, impacting responsiveness and resource cleanup.
const { spawn } = require('child_process');
const child = spawn('someCommand');
child.on('exit', (code, signal) => {
if (code !== 0) {
console.error(`Process exited with code ${code}`);
}
// Cleanup resources here
});
const { spawn } = require('child_process');
const child = spawn('someCommand');
// No listener for 'exit' or 'close' events
// No handling of exit codes
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Ignoring child process exit codes | N/A | N/A | N/A | [X] Bad |
| Listening and handling exit codes properly | N/A | N/A | N/A | [OK] Good |