Skip to content

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

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.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    child_processIssues and PRs related to the child_process subsystem.feature requestIssues requesting new Node.js features.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions