diff options
author | Michaël Zasso <targos@protonmail.com> | 2021-05-26 10:00:14 +0300 |
---|---|---|
committer | Danielle Adams <adamzdanielle@gmail.com> | 2021-05-31 22:34:57 +0300 |
commit | ee1056da6022c751c172d14ab52f32aba44db945 (patch) | |
tree | 85673bcd424886326ec39e3ed223e6e1c1e6afb2 /lib | |
parent | 3c492baa5108a8cb935496d5f4876be36bda5353 (diff) |
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
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>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/internal/inspector/_inspect.js | 4 | ||||
-rw-r--r-- | lib/internal/inspector/inspect_repl.js | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/internal/inspector/_inspect.js b/lib/internal/inspector/_inspect.js index f695fd53f1f..89e3def1929 100644 --- a/lib/internal/inspector/_inspect.js +++ b/lib/internal/inspector/_inspect.js @@ -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; diff --git a/lib/internal/inspector/inspect_repl.js b/lib/internal/inspector/inspect_repl.js index 0fcde39bfc3..8988212fa83 100644 --- a/lib/internal/inspector/inspect_repl.js +++ b/lib/internal/inspector/inspect_repl.js @@ -1146,7 +1146,7 @@ function createRepl(inspector) { return Runtime.runIfWaitingForDebugger(); } - return function startRepl() { + return async function startRepl() { inspector.client.on('close', () => { resetOnStart(); }); @@ -1154,6 +1154,9 @@ function createRepl(inspector) { initAfterStart(); }); + // Init once for the initial connection + await initAfterStart(); + const replOptions = { prompt: 'debug> ', input: inspector.stdin, @@ -1172,9 +1175,6 @@ function createRepl(inspector) { repl.emit('SIGINT'); }); - // Init once for the initial connection - initAfterStart(); - return repl; }; } |