MCPcopy Index your code
hub / github.com/nodejs/node / inspectorOpen

Function inspectorOpen

lib/inspector.js:169–196  ·  view source on GitHub ↗

* Activates inspector on host and port. * @param {number} [port] * @param {string} [host] * @param {boolean} [wait] * @returns {void}

(port, host, wait)

Source from the content-addressed store, hash-verified

167 * @returns {void}
168 */
169function inspectorOpen(port, host, wait) {
170 if (isEnabled()) {
171 throw new ERR_INSPECTOR_ALREADY_ACTIVATED();
172 }
173 // inspectorOpen() currently does not typecheck its arguments and adding
174 // such checks would be a potentially breaking change. However, the native
175 // open() function requires the port to fit into a 16-bit unsigned integer,
176 // causing an integer overflow otherwise, so we at least need to prevent that.
177 if (isUint32(port)) {
178 validateInt32(port, 'port', 0, 65535);
179 }
180 if (host && !isLoopback(host)) {
181 process.emitWarning(
182 'Binding the inspector to a public IP with an open port is insecure, ' +
183 'as it allows external hosts to connect to the inspector ' +
184 'and perform a remote code execution attack. ' +
185 'Documentation can be found at ' +
186 'https://nodejs.org/api/cli.html#--inspecthostport',
187 'SecurityWarning',
188 );
189 }
190
191 open(port, host);
192 if (wait)
193 waitForDebugger();
194
195 return { __proto__: null, [SymbolDispose]() { _debugEnd(); } };
196}
197
198/**
199 * Blocks until a client (existing or connected later)

Callers

nothing calls this directly

Calls 4

isLoopbackFunction · 0.85
openFunction · 0.70
isEnabledFunction · 0.50
isUint32Function · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…