Rev | Line | |
---|
[600] | 1 | package net.oni2.aeinstaller.backend;
|
---|
| 2 |
|
---|
| 3 | import java.io.BufferedReader;
|
---|
| 4 | import java.io.IOException;
|
---|
| 5 | import java.io.InputStream;
|
---|
| 6 | import java.io.InputStreamReader;
|
---|
| 7 | import java.util.List;
|
---|
| 8 | import java.util.Vector;
|
---|
| 9 |
|
---|
| 10 | /**
|
---|
| 11 | * @author Christian Illy
|
---|
| 12 | */
|
---|
| 13 | public class QuickAppExecution {
|
---|
| 14 |
|
---|
| 15 | /**
|
---|
| 16 | * Execute a short running application
|
---|
| 17 | *
|
---|
| 18 | * @param cmdLine
|
---|
| 19 | * List of command and arguments
|
---|
| 20 | * @return List of output lines
|
---|
| 21 | * @throws IOException
|
---|
| 22 | * Exc
|
---|
| 23 | */
|
---|
| 24 | public static Vector<String> execute(List<String> cmdLine)
|
---|
| 25 | throws IOException {
|
---|
| 26 | ProcessBuilder pb = new ProcessBuilder(cmdLine);
|
---|
| 27 | pb.redirectErrorStream(true);
|
---|
| 28 | Process proc = pb.start();
|
---|
| 29 |
|
---|
| 30 | InputStream is = proc.getInputStream();
|
---|
| 31 | InputStreamReader isr = new InputStreamReader(is);
|
---|
| 32 | BufferedReader br = new BufferedReader(isr);
|
---|
| 33 |
|
---|
| 34 | String line;
|
---|
| 35 | Vector<String> lines = new Vector<String>();
|
---|
| 36 |
|
---|
| 37 | while ((line = br.readLine()) != null) {
|
---|
| 38 | lines.add(line);
|
---|
| 39 | }
|
---|
| 40 | return lines;
|
---|
| 41 | }
|
---|
| 42 |
|
---|
| 43 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.