Skip to content

childProcess.killed should be true after process.kill(childProcess.pid) is called #27490

@ehmicky

Description

@ehmicky

Is your feature request related to a problem? Please describe.
childProcess.killed is inconsistent depending on how the child process was killed:

const { spawn } = require('child_process')
const childProcess = spawn('sleep', [5e6])
childProcess.kill()
console.log(childProcess.killed) // true
const { spawn } = require('child_process')
const childProcess = spawn('sleep', [5e6])
process.kill(childProcess.pid)
console.log(childProcess.killed) // false

Describe the solution you'd like
killed should be true when the process is killed through an external process (process.kill() or kill in the terminal).

Versions

Node 12.1.0, Ubuntu 19.04.

Metadata

Metadata

Assignees

No one assigned

    Labels

    child_processIssues and PRs related to the child_process subsystem.feature requestIssues that request new features to be added to Node.js.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions