Skip to content

Commit 6ee4cbd

Browse files
targosaduh95
authored andcommitted
debugger: wait for V8 debugger to be enabled
Refs: nodejs#38273 (comment) PR-URL: nodejs#38811 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 ac656c0 commit 6ee4cbd

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
@@ -1074,14 +1074,17 @@ function createRepl(inspector) {
10741074
.then(() => Runtime.runIfWaitingForDebugger())
10751075
}
10761076

1077-
return function startRepl() {
1077+
return async function startRepl() {
10781078
inspector.client.on('close', () => {
10791079
resetOnStart();
10801080
});
10811081
inspector.client.on('ready', () => {
10821082
initAfterStart();
10831083
});
10841084

1085+
// Init once for the initial connection
1086+
await initAfterStart();
1087+
10851088
const replOptions = {
10861089
prompt: 'debug> ',
10871090
input: inspector.stdin,
@@ -1100,9 +1103,6 @@ function createRepl(inspector) {
11001103
repl.emit('SIGINT');
11011104
});
11021105

1103-
// Init once for the initial connection
1104-
initAfterStart();
1105-
11061106
return repl;
11071107
};
11081108
}

0 commit comments

Comments
 (0)