| 10 | private static final String TAG = Shell.class.getSimpleName(); |
| 11 | |
| 12 | public static String exec(String command) { |
| 13 | try { |
| 14 | StringBuilder sb = new StringBuilder(); |
| 15 | Process p = Runtime.getRuntime().exec(command); |
| 16 | BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream())); |
| 17 | String line; |
| 18 | while ((line = br.readLine()) != null) sb.append(line).append("\n"); |
| 19 | Logger.t(TAG).d("Shell command '%s' with exit code '%s'", command, p.waitFor()); |
| 20 | return Util.substring(sb.toString()); |
| 21 | } catch (Exception e) { |
| 22 | e.printStackTrace(); |
| 23 | return ""; |
| 24 | } |
| 25 | } |
| 26 | } |