-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
Open
Labels
child_processIssues and PRs related to the child_process subsystem.Issues and PRs related to the child_process subsystem.help wantedIssues that need assistance from volunteers or PRs that need help to proceed.Issues that need assistance from volunteers or PRs that need help to proceed.
Description
- Version: v9.8.0
- Platform: Linux 64bit
- Subsystem: child_process
When calling child.disconnect() from a parent process (not in cluster mode), the child process object does not emit a close event after the exit event.
If however the child process itself calls process.disconnect() it works as expected.
Example:
// parent.js
const child_process = require('child_process');
const child = child_process.fork('./child.js', {
stdio: ['pipe', 'pipe', 'pipe', 'ipc']
});
setTimeout(() => {
child.disconnect();
}, 1000);
child.on('exit', () => {
console.log('exit');
});
child.on('close', () => {
console.log('close');
});
child.stderr.pipe(process.stderr);
child.stdout.pipe(process.stdout);// child.js
process.on('disconnect', () => {
console.log('cya');
});Output:
cya
exit
Expected Output:
cya
exit
close
RealDolos
Metadata
Metadata
Assignees
Labels
child_processIssues and PRs related to the child_process subsystem.Issues and PRs related to the child_process subsystem.help wantedIssues that need assistance from volunteers or PRs that need help to proceed.Issues that need assistance from volunteers or PRs that need help to proceed.