}
files += "\r";
monitor.setTaskName("Writing to shell...");
//No need to synchronize as we'll waitFor() the process before getting the contents.
ThreadStreamReader inputStream = new ThreadStreamReader(p.getInputStream(), false);
inputStream.start();
ThreadStreamReader errorStream = new ThreadStreamReader(p.getErrorStream(), false);
errorStream.start();
monitor.worked(1);
OutputStream outputStream = p.getOutputStream();
outputStream.write(files.getBytes());
outputStream.close();
//We'll read something in the format below:
//Name Stmts Miss Cover Missing
//-------------------------------------------------------------------------------------------------------
//D:\workspaces\temp\test_workspace\pytesting1\src\mod1\__init__ 0 0 100%
//D:\workspaces\temp\test_workspace\pytesting1\src\mod1\a 10 3 70% 4-6
//D:\workspaces\temp\test_workspace\pytesting1\src\mod1\hello 3 3 0% 1-4
//D:\workspaces\temp\test_workspace\pytesting1\src\mod1\mod2\__init__ 5 5 0% 2-8
//D:\workspaces\temp\test_workspace\pytesting1\src\mod1\mod2\hello2 33 33 0% 1-43
//-------------------------------------------------------------------------------------------------------
//TOTAL 57 50 12%
monitor.setTaskName("Waiting for process to finish...");
monitor.worked(1);
while (true) {
try {
p.exitValue();
break; //process finished
} catch (IllegalThreadStateException e) {
//not finished
}
try {
Thread.sleep(50);
} catch (InterruptedException e) {
//ignore
}
monitor.worked(1);
if (monitor.isCanceled()) {
try {
p.destroy();
} catch (Exception e) {
Log.log(e);
}
break;
}
}
String stdOut = inputStream.getAndClearContents();
String stdErr = errorStream.getAndClearContents().trim();
if (stdErr.length() > 0) {
Log.log(stdErr);
}
monitor.setTaskName("Getting coverage info...(please wait, this could take a while)");