-
-
Notifications
You must be signed in to change notification settings - Fork 35.1k
Open
Description
Version
21.4.0
Platform
Linux PC 5.15.133.1-microsoft-standard-WSL2 #1 SMP Thu Oct 5 21:02:42 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Subsystem
child_process
What steps will reproduce the bug?
Create two files:
// index.js
const { fork } = require('child_process');
console.log("forking detached child");
const child = fork('./child.js', [], {
detached: true
});
console.log("Waiting for child to disconnect...");
child.once("disconnect", () => {
console.log("child disconnected");
child.unref(); // allows the parent to shut down
});// child.js
console.log("child is alive");
setTimeout(() => {
console.log("child is disconnecting");
process.disconnect();
}, 1000);
setTimeout(() => {
console.log("child is exiting"); // this gets printed
}, 2000);then run:
node index.jsWait a moment until you see "child is exiting", then send a control code to your terminal, by pressing Ctrl+C, the up arrow, etc. If you press the up arrow you'll see ^[[A, and for Ctrl+C you'll get ^C^C. After pressing Ctrl+C you'll terminal will be restored.
I'm running Windows 11 with VSCode in WSL2 using GNU bash version 5.1.16(1)-release (x86_64-pc-linux-gnu). This does not occur on Windows VSCode (NOT WSL2) with Powershell (the child is exiting message doesn't appear).
How often does it reproduce? Is there a required condition?
No response
What is the expected behavior? Why is that the expected behavior?
The terminal state should not print control codes.
What do you see instead?
It prints control codes.
Additional information
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels