Showing
1 changed file
with
31 additions
and
31 deletions
@@ -71,40 +71,40 @@ public class CommodUtil { | @@ -71,40 +71,40 @@ public class CommodUtil { | ||
71 | * @return | 71 | * @return |
72 | */ | 72 | */ |
73 | public static List<String> exe(String commond) { | 73 | public static List<String> exe(String commond) { |
74 | - try { | ||
75 | - Thread.sleep(10000); | ||
76 | - } catch (InterruptedException e) { | ||
77 | - e.printStackTrace(); | ||
78 | - } | ||
79 | - List<String> list = new ArrayList<>(); | ||
80 | - | ||
81 | - list.add(commond); | ||
82 | - list.add(commond); | ||
83 | - return list; | ||
84 | - | ||
85 | - | ||
86 | -// Process process; | ||
87 | -// List<String> list = new ArrayList<>(); | ||
88 | -// BufferedReader input = null; | ||
89 | // try { | 74 | // try { |
90 | -// process = Runtime.getRuntime().exec(commond); | ||
91 | -// input = new BufferedReader(new InputStreamReader(process.getInputStream())); | ||
92 | -// String line; | ||
93 | -// while ((line = input.readLine()) != null) { | ||
94 | -// list.add(line); | ||
95 | -// } | ||
96 | -// } catch (Exception e) { | ||
97 | -// logger.error("process exe failed!", e); | ||
98 | -// } finally { | ||
99 | -// if (input != null) { | ||
100 | -// try { | ||
101 | -// input.close(); | ||
102 | -// } catch (IOException e) { | ||
103 | -// logger.error("process exe failed!", e); | ||
104 | -// } | ||
105 | -// } | 75 | +// Thread.sleep(10000); |
76 | +// } catch (InterruptedException e) { | ||
77 | +// e.printStackTrace(); | ||
106 | // } | 78 | // } |
79 | +// List<String> list = new ArrayList<>(); | ||
80 | +// | ||
81 | +// list.add(commond); | ||
82 | +// list.add(commond); | ||
107 | // return list; | 83 | // return list; |
84 | + | ||
85 | + | ||
86 | + Process process; | ||
87 | + List<String> list = new ArrayList<>(); | ||
88 | + BufferedReader input = null; | ||
89 | + try { | ||
90 | + process = Runtime.getRuntime().exec(commond); | ||
91 | + input = new BufferedReader(new InputStreamReader(process.getInputStream())); | ||
92 | + String line; | ||
93 | + while ((line = input.readLine()) != null) { | ||
94 | + list.add(line); | ||
95 | + } | ||
96 | + } catch (Exception e) { | ||
97 | + logger.error("process exe failed!", e); | ||
98 | + } finally { | ||
99 | + if (input != null) { | ||
100 | + try { | ||
101 | + input.close(); | ||
102 | + } catch (IOException e) { | ||
103 | + logger.error("process exe failed!", e); | ||
104 | + } | ||
105 | + } | ||
106 | + } | ||
107 | + return list; | ||
108 | } | 108 | } |
109 | 109 | ||
110 | } | 110 | } |
-
Please register or login to post a comment