Skip to content

Commit 79bfb04

Browse files
targosrichardlau
authored andcommitted
debugger: wait for V8 debugger to be enabled
Refs: #38273 (comment) PR-URL: #38811 Backport-PR-URL: #39446 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Beth Griggs <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent 721edef commit 79bfb04

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lib/internal/inspector/_inspect.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@ class NodeInspector {
203203
process.once('SIGTERM', exitCodeZero);
204204
process.once('SIGHUP', exitCodeZero);
205205

206-
PromisePrototypeCatch(PromisePrototypeThen(this.run(), () => {
207-
const repl = startRepl();
206+
PromisePrototypeCatch(PromisePrototypeThen(this.run(), async () => {
207+
const repl = await startRepl();
208208
this.repl = repl;
209209
this.repl.on('exit', exitCodeZero);
210210
this.paused = false;

lib/internal/inspector/inspect_repl.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,14 +1077,17 @@ function createRepl(inspector) {
10771077
.then(() => Runtime.runIfWaitingForDebugger());
10781078
}
10791079

1080-
return function startRepl() {
1080+
return async function startRepl() {
10811081
inspector.client.on('close', () => {
10821082
resetOnStart();
10831083
});
10841084
inspector.client.on('ready', () => {
10851085
initAfterStart();
10861086
});
10871087

1088+
// Init once for the initial connection
1089+
await initAfterStart();
1090+
10881091
const replOptions = {
10891092
prompt: 'debug> ',
10901093
input: inspector.stdin,
@@ -1103,9 +1106,6 @@ function createRepl(inspector) {
11031106
repl.emit('SIGINT');
11041107
});
11051108

1106-
// Init once for the initial connection
1107-
initAfterStart();
1108-
11091109
return repl;
11101110
};
11111111
}

0 commit comments

Comments
 (0)