How to run something after debugger is launched

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!

7 comments

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

0

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

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.

0

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

0

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

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

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

Please sign in to leave a comment.