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
    ExternalSystemUtil.runTask(|
    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)

 

0
评论操作 固定链接

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?

0

请先登录再写评论。