ExternalSystemUtil Questions


I'm using ExternalSystemUtil to run a gradle task, and am hitting some snags:

  1. It looks like for the external formatter you must supply an implementation for both `run` and `cancel`. The issue is I'm running my formatting task with
    since the formatting task is actually a Gradle task, and `runTask` doesn't return anything so I have no way to cancel the task it runs if the user invokes the Reformat action again.
  2. How do I get stdout from the task that is run
  3. How do i pass stdin to the task that will be run?

Any help here would be appreciated.


If you want to have more control about Gradle execution from IDEA, you can use `GradleTaskManager`. But it still will not allow you to set StdIn. If you need this level of control over the child Gradle invocation, I suggest you switch to ProcessHandler launch Gradle using command line (not IDEA infra)



Hi Nikita Skvortsov thanks a lot for the response! The problem is I need to be able to set stdIn in order to support "format by range" using Spotless. 

Do you have a code example you could point me to for ProcessHandler, and is there still a way to show a progress bar etc for that?