Skip to content

Commit

Permalink
debugger: wait for V8 debugger to be enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
targos committed May 26, 2021
1 parent ccde7fc commit e044242
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 e044242

Please sign in to comment.