ExternalSystemUtil Questions
已回答
I'm using ExternalSystemUtil to run a gradle task, and am hitting some snags:
- 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. - How do I get stdout from the task that is run
- 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?
You can find more details on launching external processes here: https://plugins.jetbrains.com/docs/intellij/run-configuration-execution.html#running-a-process