Skip to content
This repository was archived by the owner on Jan 13, 2024. It is now read-only.

Commit 72b2a56

Browse files
committed
1 parent cfab090 commit 72b2a56

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

test/test-50-sigusr1/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ utils.pkg.sync([
2525

2626
right = utils.spawn.sync(
2727
'./' + path.basename(output), [],
28-
{ cwd: path.dirname(output) }
28+
{ expect: null }
2929
);
3030

3131
assert.equal(right, 'ok\n');

test/utils.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,13 @@ module.exports.spawn.sync = function (command, args, opts) {
7272
opts.stdio = [ d, d, d ];
7373
}
7474

75-
const expect = opts.expect || 0;
75+
let expect = opts.expect === undefined ? 0 : opts.expect;
7676
delete opts.expect; // to avoid passing to spawnSync
77-
const opts2 = Object.assign({}, opts); // 0.12.x spoils
77+
const opts2 = Object.assign({}, opts); // 0.12.x mutates
7878
const child = spawnSync(command, args, opts2);
79-
const s = child.status;
79+
let s = child.status;
80+
// conform old node vers to https://github.com/nodejs/node/pull/11288
81+
if (child.signal) s = null;
8082

8183
if (child.error || (s !== expect)) {
8284
if (opts.stdio[1] === 'pipe' && child.stdout) {
@@ -92,6 +94,8 @@ module.exports.spawn.sync = function (command, args, opts) {
9294
throw child.error;
9395
}
9496
if (s !== expect) {
97+
if (s === null) s = 'null';
98+
if (expect === null) expect = 'null';
9599
throw new Error('Status ' + s.toString() +
96100
', expected ' + expect.toString());
97101
}

0 commit comments

Comments
 (0)