fix: callExternalProcess() not displaying stderr
This commit is contained in:
@@ -17,9 +17,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.jackhuang.hmcl.util.platform;
|
package org.jackhuang.hmcl.util.platform;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.lang.ProcessBuilder.Redirect;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -31,12 +30,10 @@ public final class SystemUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static int callExternalProcess(List<String> command) throws IOException, InterruptedException {
|
public static int callExternalProcess(List<String> command) throws IOException, InterruptedException {
|
||||||
Process process = new ProcessBuilder(command).start();
|
Process process = new ProcessBuilder(command)
|
||||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()))) {
|
.redirectOutput(Redirect.INHERIT)
|
||||||
for (String line; (line = reader.readLine()) != null;) {
|
.redirectError(Redirect.INHERIT)
|
||||||
System.out.println(line);
|
.start();
|
||||||
}
|
|
||||||
}
|
|
||||||
return process.waitFor();
|
return process.waitFor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user