Skip to content
This repository was archived by the owner on Feb 1, 2022. It is now read-only.

Commit 12530bf

Browse files
Denis SemenenkoDenis Semenenko
authored andcommitted
refactor: move resume on start logic to repl
1 parent 8817c16 commit 12530bf

2 files changed

Lines changed: 8 additions & 12 deletions

File tree

lib/_inspect.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -170,19 +170,7 @@ class NodeInspector {
170170
this.domainNames.forEach((domain) => {
171171
this[domain] = createAgentProxy(domain, this.client);
172172
});
173-
let startBreakReached = false;
174173
this.handleDebugEvent = (fullName, params) => {
175-
if (!startBreakReached &&
176-
process.env.NODE_INSPECT_RESUME_ON_START === '1' &&
177-
fullName === 'Debugger.paused' &&
178-
params && params.reason === 'Break on start') {
179-
startBreakReached = true;
180-
debuglog('Paused on start, but NODE_INSPECT_RESUME_ON_START' +
181-
' environment variable is set to 1, resuming');
182-
this.client.callMethod('Debugger.resume');
183-
return;
184-
}
185-
186174
const [domain, name] = fullName.split('.');
187175
if (domain in this) {
188176
this[domain].emit(name, params);

lib/internal/inspect_repl.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -782,6 +782,14 @@ function createRepl(inspector) {
782782
}
783783

784784
Debugger.on('paused', ({ callFrames, reason /* , hitBreakpoints */ }) => {
785+
if (process.env.NODE_INSPECT_RESUME_ON_START === '1' &&
786+
reason === 'Break on start') {
787+
debuglog('Paused on start, but NODE_INSPECT_RESUME_ON_START' +
788+
' environment variable is set to 1, resuming');
789+
inspector.client.callMethod('Debugger.resume');
790+
return;
791+
}
792+
785793
// Save execution context's data
786794
currentBacktrace = Backtrace.from(callFrames);
787795
selectedFrame = currentBacktrace[0];

0 commit comments

Comments
 (0)