-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
async_hooks: move restoreTmpHooks call to init
This fixes an error that could occure by nesting async_hooks calls PR-URL: #14054 Ref: #13755 (comment) 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>
- Loading branch information
1 parent
43c614e
commit 3388e31
Showing
2 changed files
with
24 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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()); | ||
})); |