How to implement user input in the ExternalSystem API?

Hi. I am creating a plugin for a custom build system. Using external system API I can now import the project and run its tasks directly from the IDE. I have no idea if what I'm doing is a clean code or a hack that might stop working any update, due to lacking documentation, but so far I have managed to work around all problems. However, now I am stuck and don't know how to solve this problem:

I am launching external tasks via slightly modified subclass of `com.intellij.openapi.externalSystem.service.execution.ExternalSystemRunConfiguration` and I want to implement user input to the launched task (via stdin). I see that the `ExternalSystemRunConfiguration` creates a piped stream for this purpose, which is then stored in task execution settings under RUN_INPUT_KEY. But I was unable to find any other code that uses this key and I can't find any place where I can implement that myself.

When the settings reach ExternalSystemTaskManager, user data is null and this stored stream is not accessible. Possible solutions would include getting access to the java.lang.Process in which the ExternalSystemTaskManager is being run, or alternatively, configuring it to start in-process, so that the stream would stay accessible and I could properly pipe it into the build system's process. (I am not sure if that is a good practice and/or available to third party plugins. I have found ExternalSystemApiUtil.isInProcessMode, but I haven't managed to change what it returns.)

Thanks for any help or hints.

0

Please sign in to leave a comment.