提交 f2e6dd8e authored 作者: Noel Grandin's avatar Noel Grandin

improve TestKillRestart debugging

so we catch more output if stuff goes wrong
上级 79a16ace
......@@ -9,7 +9,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.util.LinkedList;
import java.util.concurrent.TimeUnit;
import org.h2.util.IOUtils;
/**
......@@ -51,7 +50,8 @@ public class OutputCatcher extends Thread {
@Override
public void run() {
StringBuilder buff = new StringBuilder();
final StringBuilder buff = new StringBuilder();
try {
while (true) {
try {
int x = in.read();
......@@ -75,5 +75,14 @@ public class OutputCatcher extends Thread {
}
}
IOUtils.closeSilently(in);
} finally {
// just in case something goes wrong, make sure we store any partial output we got
if (buff.length() > 0) {
synchronized (list) {
list.add(buff.toString());
list.notifyAll();
}
}
}
}
}
......@@ -42,7 +42,7 @@ public class TestKillRestart extends TestBase {
int len = getSize(2, 15);
for (int i = 0; i < len; i++) {
Process p = Runtime.getRuntime().exec(procDef);
Process p = new ProcessBuilder().redirectErrorStream(true).command(procDef).start();
InputStream in = p.getInputStream();
OutputCatcher catcher = new OutputCatcher(in);
catcher.start();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论