Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.
This repository was archived by the owner on Apr 22, 2023. It is now read-only.

cluster/child_process exit event does not pass signal if child is killed #5832

Closed
@sam-github

Description

@sam-github

It appears to instead pass the raw status from wait(2) as code, and null for signal (143 == 0b10001111, the low 0b1111==15==SIGTERM).

node --version
v0.10.9-pre (head of v0.10 branch).

3.8.0-26-generic #38-Ubuntu SMP Mon Jun 17 21:43:33 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

Output:

worker pid 23321
worker on exit 143 null

assert.js:92
  throw new assert.AssertionError({
        ^
AssertionError: null == "SIGTERM"

From

assert = require('assert')
cluster = require('cluster');
if(cluster.isMaster) {
  worker=cluster.fork();
  worker.on('exit', function(code, signal) {
    console.log('worker on exit', code, signal)
    assert.equal(signal, 'SIGTERM')
  })
  worker.on('online', function() {
    console.log('worker pid', worker.process.pid)
    worker.kill('SIGTERM')
  });
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions