diff --git a/bin/run.js b/bin/run.js index 96c22db..d7dd393 100755 --- a/bin/run.js +++ b/bin/run.js @@ -1,10 +1,9 @@ -#!/usr/bin/env node --expose-internals -r internal/test/binding --debug-port=0 +#!/usr/bin/env node --expose-internals -r internal/test/binding -process.env.NODE_INSPECT_RESUME_ON_START ||= 1; +// process.env.NODE_INSPECT_RESUME_ON_START ||= 1; // process.env.NODE_INSPECT_PAUSE_ON_EXCEPTION_STATE ||= 'uncaught'; // hijack `require` to load debugger module from this package - const Mod = require('module'); const req = Mod.prototype.require; diff --git a/debugger/inspect.js b/debugger/inspect.js index 623e5b6..7a0f13e 100644 --- a/debugger/inspect.js +++ b/debugger/inspect.js @@ -32,10 +32,11 @@ const { AbortController, } = require('internal/abort_controller'); -const { 0: InspectClient, 1: createRepl } = +const { 0: InspectClient, 1: createRepl, 2: parseArguments } = [ require('internal/debugger/inspect_client'), require('internal/debugger/inspect_repl'), + require('internal/debugger/util/argument_parser'), ]; const debuglog = util.debuglog('inspect'); @@ -301,7 +302,7 @@ function startInspect(argv = ArrayPrototypeSlice(process.argv, 2), process.exit(kInvalidCommandLineArgument); } - const options = parseArgv(argv); + const options = parseArguments(argv); const inspector = new NodeInspector(options, stdin, stdout); stdin.resume(); diff --git a/debugger/inspect_repl.js b/debugger/inspect_repl.js index 2a90048..6af1b43 100644 --- a/debugger/inspect_repl.js +++ b/debugger/inspect_repl.js @@ -361,7 +361,7 @@ function aliasProperties(target, mapping) { } function createRepl(inspector) { - const { Debugger, HeapProfiler, Profiler, Runtime } = inspector; + const { Debugger, HeapProfiler, Profiler, Runtime, options: commandLineOptions } = inspector; let repl; @@ -370,7 +370,7 @@ function createRepl(inspector) { const watchedExpressions = []; const knownBreakpoints = []; let heapSnapshotPromise = null; - let pauseOnExceptionState = process.env.NODE_INSPECT_PAUSE_ON_EXCEPTION_STATE || 'none'; + let pauseOnExceptionState = commandLineOptions.pauseOnExceptionState || 'none'; let lastCommand; // Things we need to reset when the app restarts @@ -908,7 +908,7 @@ function createRepl(inspector) { } Debugger.on('paused', ({ callFrames, reason, data, asyncStackTrace }) => { - if (process.env.NODE_INSPECT_RESUME_ON_START === '1' && + if ((process.env.NODE_INSPECT_RESUME_ON_START === '1' || commandLineOptions.inspectResumeOnStart === true) && reason === 'Break on start') { debuglog('Paused on start, but NODE_INSPECT_RESUME_ON_START' + ' environment variable is set to 1, resuming');