|
@@ -13,19 +13,8 @@ public class ReadCmdLine {
|
|
|
* @param shell 命令
|
|
|
*/
|
|
|
public static void callShellByExec(String shell) {
|
|
|
- BufferedReader reader = null;
|
|
|
try {
|
|
|
- Process process = Runtime.getRuntime().exec(shell);
|
|
|
- int exitValue = process.waitFor();
|
|
|
- if (0 != exitValue) {
|
|
|
- log.error("call shell failed. error code is :" + exitValue);
|
|
|
- }
|
|
|
- // 返回值
|
|
|
- reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
|
|
|
- String line = null;
|
|
|
- while ((line = reader.readLine()) != null) {
|
|
|
- log.info("mac@wxw % " + line);
|
|
|
- }
|
|
|
+ Runtime.getRuntime().exec(shell);
|
|
|
} catch (Throwable e) {
|
|
|
log.error("call shell failed. " + e);
|
|
|
}
|