thread leaks
authorAlexey Kudravtsev <cdr@intellij.com>
Fri, 6 Nov 2015 15:06:42 +0000 (18:06 +0300)
committerAlexey Kudravtsev <cdr@intellij.com>
Mon, 9 Nov 2015 11:21:16 +0000 (14:21 +0300)
platform/util/testSrc/com/intellij/openapi/util/io/IoTestUtil.java

index 1e6e6deb03c8e7562d8fda51e377775270572159..ebc96ce401fd0a4ed89386b9095a6715d757cb23 100644 (file)
@@ -208,7 +208,7 @@ public class IoTestUtil {
   private static int runCommand(final ProcessBuilder command) throws IOException, InterruptedException {
     command.redirectErrorStream(true);
     final Process process = command.start();
   private static int runCommand(final ProcessBuilder command) throws IOException, InterruptedException {
     command.redirectErrorStream(true);
     final Process process = command.start();
-    new Thread(new Runnable() {
+    Thread thread = new Thread(new Runnable() {
       @Override
       public void run() {
         try {
       @Override
       public void run() {
         try {
@@ -228,8 +228,11 @@ public class IoTestUtil {
           throw new RuntimeException(e);
         }
       }
           throw new RuntimeException(e);
         }
       }
-    },"io test").start();
-    return process.waitFor();
+    }, "io test");
+    thread.start();
+    int ret = process.waitFor();
+    thread.join();
+    return ret;
   }
 
   public static void assertTimestampsEqual(final long expected, final long actual) {
   }
 
   public static void assertTimestampsEqual(final long expected, final long actual) {