Commits

Thomas Bright  committed 929dc3d Merge

Merged in atlassian/atlassian-processutils/STASHDEV-1915 (pull request #3)

  • Participants
  • Parent commits 4557e96, 25a4a05

Comments (0)

Files changed (1)

File src/test/java/com/atlassian/utils/process/ProcessBuilderEncodingTest.java

 import static org.junit.Assert.*;
 
 import java.io.BufferedReader;
+import java.io.IOException;
 import java.io.InputStreamReader;
 import java.nio.charset.Charset;
 import java.util.ArrayList;
 
         ProcessBuilder processBuilder = new ProcessBuilder(cmd);
         processBuilder.environment().put("CLASSPATH", System.getProperty("java.class.path"));
-        Process process = processBuilder.start();
+        final Process process = processBuilder.start();
+
+        Thread th = new Thread(new Runnable() {
+            public void run() {
+                while (true)
+                {
+                    try {
+                         process.getErrorStream().read();
+                    } catch (IOException e) {
+                    }
+                }
+            }
+        }) ;
+        th.start();
 
         BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
         try {