ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/owl/trunk/tools/SystemCmd.java
Revision: 32
Committed: Tue Mar 14 09:45:57 2006 UTC (18 years, 7 months ago) by duarte
File size: 913 byte(s)
Log Message:
New exec method taking only a String argument wasn't working. Fixed the bug.
Line User Rev File contents
1 filippis 13 package tools;
2    
3     import java.io.*;
4 duarte 32
5 filippis 13 public class SystemCmd {
6    
7 duarte 32 public static String exec(String[] cmd) {
8     String output = "";
9     try {
10     String line = "";
11     Process p = Runtime.getRuntime().exec(cmd);
12     BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
13     while ((line = input.readLine()) != null) {
14     output = output + line + "\n";
15     }
16     input.close();
17    
18     } catch (Exception err) {
19     err.printStackTrace();
20     }
21     return output;
22     }
23 filippis 13
24 duarte 32 public static String exec(String cmd) {
25     String output = "";
26     try {
27     String line = "";
28     Process p = Runtime.getRuntime().exec(cmd);
29     BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
30     while ((line = input.readLine()) != null) {
31     output = output + line + "\n";
32     }
33     input.close();
34    
35     } catch (Exception err) {
36     err.printStackTrace();
37     }
38     return output;
39 filippis 13 }
40    
41 duarte 32
42     }

Properties

Name Value
svn:executable *