• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2const common = require('../common');
3const assert = require('assert');
4
5// This test makes sure that an aborted node process
6// exits with code 3 on Windows, and SIGABRT on POSIX.
7// Spawn a child, force an abort, and then check the
8// exit code in the parent.
9
10const spawn = require('child_process').spawn;
11if (process.argv[2] === 'child') {
12  process.abort();
13} else {
14  const child = spawn(process.execPath, [__filename, 'child']);
15  child.on('exit', common.mustCall((code, signal) => {
16    if (common.isWindows) {
17      assert.strictEqual(code, 134);
18      assert.strictEqual(signal, null);
19    } else {
20      assert.strictEqual(code, null);
21      assert.strictEqual(signal, 'SIGABRT');
22    }
23  }));
24}
25