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

Allow jbang --debug to connect to a debugger #1640

Closed
danberindei opened this issue Jun 28, 2023 · 4 comments · Fixed by #1642
Closed

Allow jbang --debug to connect to a debugger #1640

danberindei opened this issue Jun 28, 2023 · 4 comments · Fixed by #1642
Labels
ideas Some idea/suggestion around jbang behavior/feature set

Comments

@danberindei
Copy link

Is your feature request related to a problem? Please describe.

I'd like to run JBang so it connects to a debugger that is listening for incoming connections.
The main advantage over JBang listening for a connection from a debugger is that in IntelliJ I can check "Auto restart" in the remote debug configuration, and a new debug session will start automatically every time I re-run the jbang script.

Describe the solution you'd like

When I run jbang --debug=server=n,address=localhost:5005, JBang should connect to my IDE listening on port 5005 instead of trying to listen on port 5005 itself.

It would also be nice to get a description of the --debug arguments in jbang --help.

Describe alternatives you've considered

I can keep using server=y and start the debugger manually every time I run the script.

Or there may be an enviromnent variable that gives me finer control over the debug arguments.

@danberindei danberindei added the ideas Some idea/suggestion around jbang behavior/feature set label Jun 28, 2023
@maxandersen
Copy link
Collaborator

Waaat? Where in your ide do You enable Listening?

@maxandersen
Copy link
Collaborator

Cool. Got it working. Never noticed that feature but for sure makes sense. It's a shame it blocks the port and can't run multiple debug sessions this way.

But yeah @quintesse suggested we allow doing:

-debug=server=n,address=localhost:5005

But also

-debug=server=n

Or any other combo of CSV values and thus let you tweak the common default avoiding repeating the common values repeatedly.

@danberindei
Copy link
Author

Sorry, I missed your question! Happy you got it working anyway.

It is indeed a shame that the debugger doesn't accept a second connection and it doesn't close the server port either, but with the auto-restart option it's still a win when doing lots of iterations on a script (or as I used to use it, running a test suite repeatedly and using conditional breakpoints to debug flaky tests).

@maxandersen
Copy link
Collaborator

Yes. It's now available in jbang latest release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ideas Some idea/suggestion around jbang behavior/feature set
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants