@param shellProgPath @param args @param caller @description: @return: void @author mike/Fang.J @data 2022/11/29
(String shellProgPath, String[] args, Function<String, Integer> caller)
| 79 | * @data 2022/11/29 |
| 80 | */ |
| 81 | public static void runShell(String shellProgPath, String[] args, Function<String, Integer> caller) { |
| 82 | |
| 83 | try { |
| 84 | Process p = Runtime.getRuntime().exec(args); |
| 85 | //caller没有考虑线程安全 |
| 86 | new Thread(new RunShellThread().setCaller(caller).setInputStream(p.getInputStream())).start(); |
| 87 | new Thread(new RunShellThread().setCaller(caller).setInputStream(p.getErrorStream())).start(); |
| 88 | p.waitFor(); |
| 89 | } catch (Exception e) { |
| 90 | throw new RuntimeException(e); |
| 91 | } |
| 92 | |
| 93 | } |
| 94 | |
| 95 | } |
no test coverage detected