windowsHide:true prevents SIGINT on child processesΒ #29837
Copy link
Copy link
Closed
Labels
consoleIssues and PRs related to the console subsystem.Issues and PRs related to the console subsystem.windowsIssues and PRs related to the Windows platform.Issues and PRs related to the Windows platform.
Description
- Version: v12.10.0
- Platform: Windows 10 x64
- Subsystem:
Example code:
const fs = require('fs')
const { spawn } = require('child_process')
const CODE = `
const fs = require('fs')
process.on('SIGINT', () => {
fs.appendFile('output.log', 'SIGINT Child\\n', () => {})
server.close()
})
fs.appendFile('output.log', 'Started Child\\n', () => {})
const http = require('http')
const server = http.createServer()
server.listen()
`
fs.appendFile('output.log', 'Started Parent\n', () => {})
spawn(process.execPath, ['-e', CODE], {
windowsHide: true
})
Expected output.log after Ctrl+C in Command Prompt node main.js
Started Parent
Started Child
SIGINT Child
Actual:
Started Parent
Started Child
The SIGINT signal is never sent to the child processes. I don't see this documented in the windowsHide flag. Setting the value to false results in the expected signal being sent. I know windows doesn't really do signals this way, but it seems inconsistent.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
consoleIssues and PRs related to the console subsystem.Issues and PRs related to the console subsystem.windowsIssues and PRs related to the Windows platform.Issues and PRs related to the Windows platform.
Activity
bnoordhuis commentedon Oct 4, 2019
^C handling is implemented through
SetConsoleCtrlHandler(). As you can probably guess from the name, that function only works when there's an actual console.Not a bug, in other words, but feel free to send a PR if you think the documentation can be improved.
bnoordhuis commentedon Oct 6, 2019
I infer from the execa issue that you're not interested in documenting this so I'll go ahead and close out the issue. PR still welcome, of course.
Remove leading asterisks from TSDoc comments
set `windowsHide: true` when spawning a process
set `windowsHide: true` when spawning a process
fix(core): repair SIGINT signals on windows (#28496)
fix(core): repair SIGINT signals on windows (#28496)