debugger: wait for V8 debugger to be enabled

Refs: https://github.com/nodejs/node/pull/38273#issuecomment-848438189

PR-URL: https://github.com/nodejs/node/pull/38811
Backport-PR-URL: https://github.com/nodejs/node/pull/39446
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>
This commit is contained in:
Michaël Zasso 2021-05-26 09:00:14 +02:00 committed by Richard Lau
parent 721edeffd3
commit 79bfb0416b
No known key found for this signature in database
GPG Key ID: C43CEC45C17AB93C
2 changed files with 6 additions and 6 deletions

View File

@ -203,8 +203,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;

View File

@ -1077,7 +1077,7 @@ function createRepl(inspector) {
.then(() => Runtime.runIfWaitingForDebugger());
}
return function startRepl() {
return async function startRepl() {
inspector.client.on('close', () => {
resetOnStart();
});
@ -1085,6 +1085,9 @@ function createRepl(inspector) {
initAfterStart();
});
// Init once for the initial connection
await initAfterStart();
const replOptions = {
prompt: 'debug> ',
input: inspector.stdin,
@ -1103,9 +1106,6 @@ function createRepl(inspector) {
repl.emit('SIGINT');
});
// Init once for the initial connection
initAfterStart();
return repl;
};
}