Search in sources :

Example 1 with PrintOutputLineProcessor

use of com.google.idea.blaze.base.async.process.PrintOutputLineProcessor in project intellij by bazelbuild.

the class BlazeInfoRunnerImpl method runBlazeInfo.

private static ByteArrayOutputStream runBlazeInfo(String binaryPath, WorkspaceRoot workspaceRoot, @Nullable String key, List<String> blazeFlags, BlazeContext context) throws BlazeInfoException {
    BlazeCommand.Builder builder = BlazeCommand.builder(binaryPath, BlazeCommandName.INFO);
    if (key != null) {
        builder.addBlazeFlags(key);
    }
    BlazeCommand command = builder.addBlazeFlags(blazeFlags).build();
    ByteArrayOutputStream stdout = new ByteArrayOutputStream();
    int exitCode = ExternalTask.builder(workspaceRoot).addBlazeCommand(command).context(context).stdout(stdout).stderr(LineProcessingOutputStream.of(new PrintOutputLineProcessor(context))).build().run();
    if (exitCode != 0) {
        throw new BlazeInfoException(exitCode, stdout.toString());
    }
    return stdout;
}
Also used : BlazeCommand(com.google.idea.blaze.base.command.BlazeCommand) ByteArrayOutputStream(java.io.ByteArrayOutputStream) PrintOutputLineProcessor(com.google.idea.blaze.base.async.process.PrintOutputLineProcessor)

Aggregations

PrintOutputLineProcessor (com.google.idea.blaze.base.async.process.PrintOutputLineProcessor)1 BlazeCommand (com.google.idea.blaze.base.command.BlazeCommand)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1