Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 42fc754

Browse filesBrowse files
joyeecheungBridgeAR
authored andcommitted
process: register the inspector async hooks in bootstrap/node.js
So it's easier to tell the side effects of this setup. PR-URL: #25443 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 3061cb5 commit 42fc754
Copy full SHA for 42fc754

File tree

Expand file treeCollapse file tree

2 files changed

+9
-10
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+9
-10
lines changed
Open diff view settings
Collapse file

‎lib/internal/bootstrap/node.js‎

Copy file name to clipboardExpand all lines: lib/internal/bootstrap/node.js
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,11 @@ function startup() {
151151
}
152152

153153
if (config.hasInspector) {
154-
NativeModule.require('internal/inspector_async_hook').setup();
154+
const {
155+
enable,
156+
disable
157+
} = NativeModule.require('internal/inspector_async_hook');
158+
internalBinding('inspector').registerAsyncHook(enable, disable);
155159
}
156160

157161
// If the process is spawned with env NODE_CHANNEL_FD, it's probably
Collapse file

‎lib/internal/inspector_async_hook.js‎

Copy file name to clipboardExpand all lines: lib/internal/inspector_async_hook.js
+4-9Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
11
'use strict';
22

3-
const inspector = internalBinding('inspector');
4-
5-
if (!inspector || !inspector.asyncTaskScheduled) {
6-
exports.setup = function() {};
7-
return;
8-
}
9-
103
let hook;
114
let config;
125

136
function lazyHookCreation() {
7+
const inspector = internalBinding('inspector');
148
const { createHook } = require('async_hooks');
159
config = internalBinding('config');
1610

@@ -72,6 +66,7 @@ function disable() {
7266
hook.disable();
7367
}
7468

75-
exports.setup = function() {
76-
inspector.registerAsyncHook(enable, disable);
69+
module.exports = {
70+
enable,
71+
disable
7772
};

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.