Coverage: report generation fixed.

This commit is contained in:
Dmitry Trofimov
2012-04-24 21:41:36 +02:00
parent 62291adba8
commit cbfb20c2ae
2 changed files with 48 additions and 12 deletions
@@ -0,0 +1,47 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.execution.process;
import com.intellij.openapi.util.Key;
/**
* @author traff
*/
public class CapturingProcessAdapter extends ProcessAdapter {
private ProcessOutput myOutput;
public CapturingProcessAdapter(ProcessOutput output) {
myOutput = output;
}
public CapturingProcessAdapter() {
this(new ProcessOutput());
}
@Override
public void onTextAvailable(ProcessEvent event, Key outputType) {
if (outputType == ProcessOutputTypes.STDOUT) {
myOutput.appendStdout(event.getText());
}
if (outputType == ProcessOutputTypes.STDERR) {
myOutput.appendStderr(event.getText());
}
}
public ProcessOutput getOutput() {
return myOutput;
}
}
@@ -16,7 +16,6 @@
package com.intellij.execution.process;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.Key;
import java.nio.charset.Charset;
@@ -41,17 +40,7 @@ public class CapturingProcessHandler extends OSProcessHandler {
public CapturingProcessHandler(final Process process, final Charset charset, final String commandLine) {
super(process, commandLine, charset);
myCharset = charset;
addProcessListener(new ProcessAdapter() {
@Override
public void onTextAvailable(ProcessEvent event, Key outputType) {
if (outputType == ProcessOutputTypes.STDOUT) {
myOutput.appendStdout(event.getText());
}
if (outputType == ProcessOutputTypes.STDERR) {
myOutput.appendStderr(event.getText());
}
}
});
addProcessListener(new CapturingProcessAdapter(myOutput));
}
public ProcessOutput runProcess() {