0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/parallel/test-async-hooks-enable-recursive.js
Ruben Bridgewater 8a830350b2
async_hooks: move restoreTmpHooks call to init
This fixes an error that could occure by nesting async_hooks calls

PR-URL: https://github.com/nodejs/node/pull/14054
Ref: https://github.com/nodejs/node/pull/13755#issuecomment-312616004
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Andreas Madsen <amwebdk@gmail.com>
2017-07-13 11:57:44 +02:00

20 lines
405 B
JavaScript

'use strict';
const common = require('../common');
const async_hooks = require('async_hooks');
const fs = require('fs');
const nestedHook = async_hooks.createHook({
init: common.mustCall()
});
async_hooks.createHook({
init: common.mustCall((id, type) => {
nestedHook.enable();
}, 2)
}).enable();
fs.access(__filename, common.mustCall(() => {
fs.access(__filename, common.mustCall());
}));