(argv = ArrayPrototypeSlice(process.argv, 2),
stdin = process.stdin,
stdout = process.stdout)
| 318 | } |
| 319 | |
| 320 | function startInspect(argv = ArrayPrototypeSlice(process.argv, 2), |
| 321 | stdin = process.stdin, |
| 322 | stdout = process.stdout) { |
| 323 | const invokedAs = `${process.argv0} ${process.argv[1]}`; |
| 324 | |
| 325 | if (argv.length < 1) { |
| 326 | writeInspectUsageAndExit(invokedAs, undefined, kInvalidCommandLineArgument); |
| 327 | } |
| 328 | |
| 329 | const parsed = parseInspectMode(argv); |
| 330 | |
| 331 | if (parsed.mode === 'help') { |
| 332 | writeInspectUsageAndExit(invokedAs); |
| 333 | } |
| 334 | |
| 335 | if (parsed.mode === 'probe') { |
| 336 | let probeOptions; |
| 337 | try { |
| 338 | probeOptions = parseProbeTokens(parsed.tokens, parsed.args); |
| 339 | } catch (error) { |
| 340 | writeInspectUsageAndExit(invokedAs, error.message, kInvalidCommandLineArgument); |
| 341 | } |
| 342 | runProbeMode(stdout, probeOptions); |
| 343 | return; |
| 344 | } |
| 345 | |
| 346 | const options = parseInteractiveArgs(argv); |
| 347 | const inspector = new NodeInspector(options, stdin, stdout); |
| 348 | |
| 349 | stdin.resume(); |
| 350 | |
| 351 | function handleUnexpectedError(e) { |
| 352 | if (e.code !== 'ERR_DEBUGGER_STARTUP_ERROR') { |
| 353 | process.stderr.write('There was an internal error in Node.js. ' + |
| 354 | 'Please report this bug.\n' + |
| 355 | `${e.message}\n${e.stack}\n`); |
| 356 | } else { |
| 357 | process.stderr.write(e.message); |
| 358 | process.stderr.write('\n'); |
| 359 | } |
| 360 | if (inspector.child) inspector.child.kill(); |
| 361 | process.exit(kGenericUserError); |
| 362 | } |
| 363 | |
| 364 | process.on('uncaughtException', handleUnexpectedError); |
| 365 | } |
| 366 | exports.start = startInspect; |
nothing calls this directly
no test coverage detected
searching dependent graphs…