lyhzzz 3 năm trước cách đây
mục cha
commit
eb1f29ab16

+ 2 - 3
src/main/java/com/fdkankan/fusion/common/util/ShellUtil.java

@@ -21,10 +21,9 @@ public class ShellUtil {
         long startTime = System.currentTimeMillis();
         long startTime = System.currentTimeMillis();
 
 
         try {
         try {
-            String[] commond = {"/bin/sh","-c",cmd};
             // 执行命令, 返回一个子进程对象(命令在子进程中执行)
             // 执行命令, 返回一个子进程对象(命令在子进程中执行)
-            log.info("执行cmd:{}",commond);
-            process = Runtime.getRuntime().exec(commond);
+            log.info("执行cmd:{}",cmd);
+            process = Runtime.getRuntime().exec(cmd);
             // 方法阻塞, 等待命令执行完成(成功会返回0)
             // 方法阻塞, 等待命令执行完成(成功会返回0)
             process.waitFor();
             process.waitFor();
             // 获取命令执行结果, 有两个结果: 正常的输出 和 错误的输出(PS: 子进程的输出就是主进程的输入)
             // 获取命令执行结果, 有两个结果: 正常的输出 和 错误的输出(PS: 子进程的输出就是主进程的输入)