2017-09-09 20:28:02 +00:00
|
|
|
'use strict';
|
|
|
|
const common = require('../../common');
|
|
|
|
const assert = require('assert');
|
|
|
|
const child_process = require('child_process');
|
|
|
|
|
|
|
|
if (process.argv[2] === 'child') {
|
|
|
|
require(`./build/${common.buildType}/binding`);
|
|
|
|
} else {
|
2023-02-17 08:49:54 +00:00
|
|
|
const { stdout, status, signal } =
|
2017-09-09 20:28:02 +00:00
|
|
|
child_process.spawnSync(process.execPath, [__filename, 'child']);
|
2023-02-17 08:49:54 +00:00
|
|
|
assert.strictEqual(status, 0, `process exited with status(${status}) and signal(${signal})`);
|
2017-09-09 20:28:02 +00:00
|
|
|
assert.strictEqual(stdout.toString().trim(), 'cleanup(42)');
|
|
|
|
}
|