MCPcopy Create free account
hub / github.com/anons-org/opencar / runShell

Method runShell

src/main/java/com/far/vms/opencar/ui/ShellUtil.java:81–93  ·  view source on GitHub ↗

@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)

Source from the content-addressed store, hash-verified

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}

Callers 2

addCodeMethod · 0.95
buildElfToBinMethod · 0.95

Calls 4

setInputStreamMethod · 0.80
setCallerMethod · 0.80
getInputStreamMethod · 0.80
startMethod · 0.45

Tested by

no test coverage detected