public void run() {
ProcessBuilder procBuilder;
Process process;
String line;
OutputWriter outputWriter = CucumberOutputWindow.getOutputWriter(dObj.getPrimaryFile().getNameExt(), getActions());
commandList.addAll(this.getSystemSpecificHeader());
commandList.addAll(this.getRubySpecificHeader());
commandList.add("cucumber");
commandList.addAll(this.getRecursiveOption());
commandList.add(fileName);
commandList.addAll(this.getOptions());
procBuilder = new ProcessBuilder(commandList);
procBuilder.redirectErrorStream(true);
if (useDirectoryOption()) {
procBuilder.directory(getDirectory());
}
try {
process = procBuilder.start();
stop.setProcess(process);
InputStream is = process.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
outputWriter.printf("Output of running %s is:\n", commandList.toString());
outputWriter.printf("--- START ---\n\n");
while ((line = br.readLine()) != null) {
outputWriter.println(line);
}
outputWriter.printf("--- END ---\n\n");
} catch (IOException ex) {
Exceptions.printStackTrace(ex);
} finally {
outputWriter.close();
}
}