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

Method constructor

test/common/inspector-helper.js:343–378  ·  view source on GitHub ↗
(inspectorFlags = ['--inspect-brk=0', '--expose-internals'],
              scriptContents = '',
              scriptFile = _MAINSCRIPT,
              logger = console)

Source from the content-addressed store, hash-verified

341
342class NodeInstance extends EventEmitter {
343 constructor(inspectorFlags = ['--inspect-brk=0', '--expose-internals'],
344 scriptContents = '',
345 scriptFile = _MAINSCRIPT,
346 logger = console) {
347 super();
348
349 this._logger = logger;
350 this._scriptPath = scriptFile;
351 this._script = scriptFile ? null : scriptContents;
352 this._portCallback = null;
353 this.resetPort();
354 this._process = spawnChildProcess(inspectorFlags, scriptContents,
355 scriptFile);
356 this._running = true;
357 this._stderrLineCallback = null;
358 this._unprocessedStderrLines = [];
359
360 this._process.stdout.on('data', makeBufferingDataCallback(
361 (line) => {
362 this.emit('stdout', line);
363 this._logger.log('[out]', line);
364 }));
365
366 this._process.stderr.on('data', makeBufferingDataCallback(
367 (message) => this.onStderrLine(message)));
368
369 this._shutdownPromise = new Promise((resolve) => {
370 this._process.once('exit', (exitCode, signal) => {
371 if (signal) {
372 this._logger.error(`[err] child process crashed, signal ${signal}`);
373 }
374 resolve({ exitCode, signal });
375 this._running = false;
376 });
377 });
378 }
379
380 get pid() {
381 return this._process.pid;

Callers

nothing calls this directly

Calls 10

resetPortMethod · 0.95
onStderrLineMethod · 0.95
spawnChildProcessFunction · 0.85
resolveFunction · 0.70
onMethod · 0.45
emitMethod · 0.45
logMethod · 0.45
onceMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected