/
YarnExecutor.java
30 lines (23 loc) · 1.06 KB
/
YarnExecutor.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package com.github.eirslett.maven.plugins.frontend.lib;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
final class YarnExecutor {
private final ProcessExecutor executor;
public YarnExecutor(YarnExecutorConfig config, List<String> arguments,
Map<String, String> additionalEnvironment) {
final String yarn = config.getYarnPath().getAbsolutePath();
List<String> localPaths = new ArrayList<>();
localPaths.add(config.getYarnPath().getParent());
localPaths.add(config.getNodePath().getParent());
executor = new ProcessExecutor(config.getWorkingDirectory(), localPaths,
Utils.prepend(yarn, arguments), config.getPlatform(), additionalEnvironment);
}
public String executeAndGetResult(final Logger logger) throws ProcessExecutionException {
return executor.executeAndGetResult(logger);
}
public int executeAndRedirectOutput(final Logger logger) throws ProcessExecutionException {
return executor.executeAndRedirectOutput(logger);
}
}