8290885: java/lang/ProcessBuilder/PipelineLeaksFD.java fail: More or fewer pipes than expected
Reviewed-by: bpb, naoto, jpai
This commit is contained in:
parent
464085ed90
commit
226b8e680a
@ -29,4 +29,3 @@
|
||||
|
||||
java/lang/invoke/MethodHandles/CatchExceptionTest.java 8146623 generic-all
|
||||
java/lang/ref/ReferenceEnqueue.java 8284236 generic-all
|
||||
java/lang/ProcessBuilder/PipelineLeaksFD.java 8290885 generic-all
|
||||
|
@ -68,11 +68,18 @@ public class PipelineLeaksFD {
|
||||
Assert.fail("There should be at least 3 pipes before, (0, 1, 2)");
|
||||
}
|
||||
|
||||
// Redirect all of the error streams to stdout (except the last)
|
||||
// so those file descriptors are not left open
|
||||
for (int i = 0; i < builders.size() - 1; i++) {
|
||||
builders.get(i).redirectErrorStream(true);
|
||||
}
|
||||
|
||||
List<Process> processes = ProcessBuilder.startPipeline(builders);
|
||||
|
||||
OutputStream out = processes.get(0).getOutputStream();
|
||||
out.write('a');
|
||||
out.close();
|
||||
// Write something through the pipeline
|
||||
try (OutputStream out = processes.get(0).getOutputStream()) {
|
||||
out.write('a');
|
||||
}
|
||||
|
||||
Process last = processes.get(processes.size() - 1);
|
||||
try (InputStream inputStream = last.getInputStream();
|
||||
@ -86,7 +93,6 @@ public class PipelineLeaksFD {
|
||||
processes.forEach(p -> waitForQuiet(p));
|
||||
|
||||
Set<PipeRecord> pipesAfter = myPipes();
|
||||
printPipes(pipesAfter, "DEBUG: All Pipes After");
|
||||
if (!pipesBefore.equals(pipesAfter)) {
|
||||
Set<PipeRecord> missing = new HashSet<>(pipesBefore);
|
||||
missing.removeAll(pipesAfter);
|
||||
|
Loading…
Reference in New Issue
Block a user