Skip to content

test: common.nodeProcessAborted() does not catch aborts in Windows #12823

@gireeshpunathil

Description

@gireeshpunathil
  • Version: v7.8.0 for example.
  • Platform: Windows (10, for example)
  • Subsystem: test (common.js)

Looks like common.nodeProcessAborted() (test/common.js) does not cover Windows aborts comprehensively. Results from MAC and Windows on a sample code show the difference:

'use strict';
const common = require('../common');
const assert = require('assert');
const spawn = require('child_process').spawn;

if (process.argv[2] === 'child') {
  process.abort();
} else {
  const child = spawn(process.argv[0], [process.argv[1], 'child']);
  child.on('exit', common.mustCall((code, signal) => {
    console.log('child exited with code: ' + code + ' and signal: ' + signal);
    assert(common.nodeProcessAborted(code, signal),
           'process should have aborted, but did not');
  }));
}

MAC:

child exited with code: null and signal: SIGABRT

Windows:

child exited with code: 3 and signal: null
assert.js:81
  throw new assert.AssertionError({
  ^
AssertionError: process should have aborted, but did not
    at ChildProcess.child.on.common.mustCall (D:\gireesh\parser\node\test\parallel\foo.js:12:5)
    at ChildProcess.<anonymous> (D:\gireesh\parser\node\test\common.js:452:15)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:194:7)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:208:12)

Metadata

Metadata

Assignees

No one assigned

    Labels

    testIssues and PRs related to the tests.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