1'use strict'; 2require('../common'); 3const assert = require('assert'); 4 5// Ensure that the reallyExit hook is executed. 6// see: https://github.com/nodejs/node/issues/25650 7if (process.argv[2] === 'subprocess') { 8 process.reallyExit = function() { 9 console.info('really exited'); 10 }; 11 process.exit(); 12} else { 13 const { spawnSync } = require('child_process'); 14 const out = spawnSync(process.execPath, [__filename, 'subprocess']); 15 const observed = out.output[1].toString('utf8').trim(); 16 assert.strictEqual(observed, 'really exited'); 17} 18