..
..15mo ago

How can I reattach a debugger after disconnecting?

I want to be able to start deno from a command line, but be able to attach to it from VSCode. I actually have that much working, but there is one issue - if I disconnect the debugger, I cannot reattach it. I am running like so: deno run --inspect-wait .\first_steps.ts I am attaching with this configuration:
{
"request": "attach",
"name": "Attach To Running Program",
"type": "node",
"cwd": "${workspaceFolder}",
"port": 9229,
}
{
"request": "attach",
"name": "Attach To Running Program",
"type": "node",
"cwd": "${workspaceFolder}",
"port": 9229,
}
The source code is a couple of loops that each take a few seconds to execute. After hitting a breakpoint in the first loop, I disconnect. I then immediately try to reconnect, but it seems the program ignores the attempt until it finishes running. Is there anything I can do differently to be able to reattach the debugger?
1 Reply
..
..15mo ago
This understandably doesn't work with a blocking loop; a loop such as that here seems to work, though: https://examples.deno.land/tcp-listener