Skip to content

Commit

Permalink
debugger: wait for V8 debugger to be enabled
Browse files Browse the repository at this point in the history
Refs: #38273 (comment)

PR-URL: #38811
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Beth Griggs <bgriggs@redhat.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
targos committed May 28, 2021
1 parent 0222a10 commit f1cbaea
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/internal/inspector/_inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ class NodeInspector {
process.once('SIGTERM', exitCodeZero);
process.once('SIGHUP', exitCodeZero);

PromisePrototypeCatch(PromisePrototypeThen(this.run(), () => {
const repl = startRepl();
PromisePrototypeCatch(PromisePrototypeThen(this.run(), async () => {
const repl = await startRepl();
this.repl = repl;
this.repl.on('exit', exitCodeZero);
this.paused = false;
Expand Down
8 changes: 4 additions & 4 deletions lib/internal/inspector/inspect_repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -1146,14 +1146,17 @@ function createRepl(inspector) {
return Runtime.runIfWaitingForDebugger();
}

return function startRepl() {
return async function startRepl() {
inspector.client.on('close', () => {
resetOnStart();
});
inspector.client.on('ready', () => {
initAfterStart();
});

// Init once for the initial connection
await initAfterStart();

const replOptions = {
prompt: 'debug> ',
input: inspector.stdin,
Expand All @@ -1172,9 +1175,6 @@ function createRepl(inspector) {
repl.emit('SIGINT');
});

// Init once for the initial connection
initAfterStart();

return repl;
};
}
Expand Down

0 comments on commit f1cbaea

Please sign in to comment.