blob: 487a4ecef52d8b5abc3d044172fca2cf5f296375 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
'use strict';
const common = require('../common');
const assert = require('assert');
let once = 0;
process.on('beforeExit', () => {
if (once > 1)
throw new RangeError('beforeExit should only have been called once!');
setTimeout(common.noop, 1).unref();
once++;
});
process.on('exit', (code) => {
if (code !== 0) return;
assert.strictEqual(once, 1);
});
|