|
@@ -5,6 +5,8 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import java.io.BufferedReader;
|
|
|
import java.io.Closeable;
|
|
|
import java.io.InputStreamReader;
|
|
|
+import java.net.URL;
|
|
|
+import java.nio.charset.StandardCharsets;
|
|
|
|
|
|
@Slf4j
|
|
|
public class ShellUtil {
|
|
@@ -27,8 +29,8 @@ public class ShellUtil {
|
|
|
// 方法阻塞, 等待命令执行完成(成功会返回0)
|
|
|
process.waitFor();
|
|
|
// 获取命令执行结果, 有两个结果: 正常的输出 和 错误的输出(PS: 子进程的输出就是主进程的输入)
|
|
|
- bufrIn = new BufferedReader(new InputStreamReader(process.getInputStream(), "UTF-8"));
|
|
|
- bufrError = new BufferedReader(new InputStreamReader(process.getErrorStream(), "UTF-8"));
|
|
|
+ bufrIn = new BufferedReader(new InputStreamReader(process.getInputStream(), StandardCharsets.UTF_8));
|
|
|
+ bufrError = new BufferedReader(new InputStreamReader(process.getErrorStream(), StandardCharsets.UTF_8));
|
|
|
// 读取输出
|
|
|
// String line = null;
|
|
|
// while ((line = bufrIn.readLine()) != null) {
|