diff options
author | Ruben Bridgewater <ruben@bridgewater.de> | 2017-07-03 14:16:12 +0200 |
---|---|---|
committer | Andreas Madsen <amwebdk@gmail.com> | 2017-07-13 11:57:44 +0200 |
commit | 8a830350b226b4e56cdf3cd519e62ff8a071f9c3 (patch) | |
tree | f53a567ee74aeed723343e0fc3a1c7be7173d29a /test/parallel/test-async-hooks-enable-recursive.js | |
parent | 5ffb5b6fce376fa08be1af7552ce6d6c9e80bc56 (diff) | |
download | android-node-v8-8a830350b226b4e56cdf3cd519e62ff8a071f9c3.tar.gz android-node-v8-8a830350b226b4e56cdf3cd519e62ff8a071f9c3.tar.bz2 android-node-v8-8a830350b226b4e56cdf3cd519e62ff8a071f9c3.zip |
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>
Diffstat (limited to 'test/parallel/test-async-hooks-enable-recursive.js')
-rw-r--r-- | test/parallel/test-async-hooks-enable-recursive.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/parallel/test-async-hooks-enable-recursive.js b/test/parallel/test-async-hooks-enable-recursive.js new file mode 100644 index 0000000000..bcb0dcc0ce --- /dev/null +++ b/test/parallel/test-async-hooks-enable-recursive.js @@ -0,0 +1,19 @@ +'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()); +})); |