if (AppContext.RUN != null) {
AppContext.RUN.ui.debug(
workingDirectory + "$ " + Joiner.on(" ").join(cmdArgs));
}
ProcessBuilder pb = new ProcessBuilder(cmdArgs);
if (workingDirectory != null && !workingDirectory.isEmpty()) {
pb.directory(new File(workingDirectory));
}
Process p;
int returnStatus;
String stdoutData, stderrData;
try {
p = pb.start();
p.getOutputStream().close();
// We need to read data from the output steams.
// Why? Because if we don't read from them, then the process we have started will fill the
// buffers and block. We will be in a deadlock.
// If there were only one stream, we could just do repeated calls to read() until we got