Skip to content

Commit ee4390a

Browse files
committed
repl: fix tab completion of inspector module
Correctly check for the presence of the inspector module before adding it to the builtin libs list. PR-URL: #19505 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent cae9ff2 commit ee4390a

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

lib/internal/module.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ const builtinLibs = [
8989
'stream', 'string_decoder', 'tls', 'tty', 'url', 'util', 'v8', 'vm', 'zlib'
9090
];
9191

92-
if (typeof process.binding('inspector').connect === 'function') {
92+
if (typeof process.binding('inspector').open === 'function') {
9393
builtinLibs.push('inspector');
9494
builtinLibs.sort();
9595
}
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
'use strict';
2+
// Flags: --expose-internals
3+
4+
require('../common');
5+
const assert = require('assert');
6+
const { builtinLibs } = require('internal/module');
7+
8+
const hasInspector = process.config.variables.v8_enable_inspector === 1;
9+
10+
const expectedLibs = hasInspector ? 32 : 31;
11+
assert.strictEqual(builtinLibs.length, expectedLibs);

0 commit comments

Comments
 (0)