Skip to content

windowsHide:true prevents SIGINT on child processes #29837

Closed
@jabrown85

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    consoleIssues and PRs related to the console subsystem.windowsIssues and PRs related to the Windows platform.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions