Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debugger: wait for V8 debugger to be enabled #38811

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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