How to run something after debugger is launched

Answered

I must be missing something very obvious: there's a "Before launch" UI element that allows you to specify something to run before the debug config runs. What I'm looking for is an "After launch" function that will run something after the debugger starts. Specifically, I'm remote debugging and I need to run a script that starts the remote app after I'm sure the debug server is up and running.

Again, it must be something very simple. Thanks!

15
11 comments
Avatar
Permanently deleted user

You'd think it would be something very simple, but the functionality is very simply not there.

0
Avatar
Permanently deleted user

I have a similar requirement where I need to run a task against my running weblogic instance that gets spun-up by intellij. I cannot find a way to do this.

0
Avatar
Permanently deleted user

This would be very useful. My case: I want to start a docker database before tests run. I can do this by using "Before launch" and setting it to run a gradle task, but I don't see how I can stop the database once the tests are done.

2
Avatar
Permanently deleted user

I have the exact same need.  Please add this functionality.

0
Avatar
Permanently deleted user

I just figured out a way to do this with PyCharm so it should be possible in all JetBrain IDEs.

If you want Y to run after X, the way to achieve this now is to run X before Y.  In my case I simply want to generate API docs with Sphinx (X) and then launch a browser to view them (Y).  X was a very standard Run configuration and Y was fairly straightforward as type Bash with Script set to  /usr/bin/chromium-browser, Interpreter path as /bin/bash, Program args set to where my index.html got created.

It should be easy to adapt this to any situation.  Ideally JetBrains would provide Launch After settings to provide symmetry with the existing Launch Before settings.

0
Avatar
Permanently deleted user

Err, what I wrote works great for Run ordering but alas won't cut it for Debug ordering as was asked since the Before Launch feature only allows you to Run another configuration not Debug another.  Sorry!

1
Avatar
Permanently deleted user

I worked around the problem by running a Before Launch script that just waits several seconds (allowing the remote debugger to get started) before it does what it needs to do.

0
Avatar
Permanently deleted user

Maybe you can try to add a new configuration from the template  *Compound*

1
Avatar
Permanently deleted user

+1

That would be really nice

0

Hi all,

Please vote for the corresponding feature request https://youtrack.jetbrains.com/issue/IDEA-132501
At the moment, the only similar thing you can use is the Compound run configuration https://www.jetbrains.com/help/pycharm/creating-compound-run-debug-configuration.html, but it applies only to the cases when one doesn't need the second process to wait for the first one to finish.

1

Please sign in to leave a comment.