21import java.io.IOException;
22import java.util.ArrayList;
23import java.util.Arrays;
26import denoptim.exception.DENOPTIMException;
35 private transient Process
proc =
null;
50 @SuppressWarnings(
"unused")
51 private String
id = null;
81 ProcessBuilder pb =
new ProcessBuilder(
"/bin/bash",
"-c",
cmdStr);
84 Runtime.getRuntime().addShutdownHook(
new Thread()
101 errorGobbler.start();
102 outputGobbler.start();
105 outputGobbler.join();
110 outputGobbler.
sb.setLength(0);
112 errorGobbler.
sb.setLength(0);
115 catch(IllegalArgumentException iae)
121 catch(NullPointerException npe)
127 catch(IOException ioe)
144 proc.getOutputStream().close();
145 proc.getInputStream().close();
146 proc.getErrorStream().close();
148 }
catch (IOException e) {
172 List<String> command =
new ArrayList<String>(Arrays.asList(
174 ProcessBuilder pb =
new ProcessBuilder(command);
180 Runtime.getRuntime().addShutdownHook(
new Thread()
197 errorGobbler.start();
198 outputGobbler.start();
201 outputGobbler.join();
206 outputGobbler.
sb.setLength(0);
208 errorGobbler.
sb.setLength(0);
211 catch(IllegalArgumentException iae)
217 catch(NullPointerException npe)
223 catch(IOException ioe)
240 proc.getOutputStream().close();
241 proc.getInputStream().close();
242 proc.getErrorStream().close();
244 }
catch (IOException e) {
294 proc.getOutputStream().close();
295 proc.getInputStream().close();
296 proc.getErrorStream().close();
void runProcess()
Run the process associated with the command.
String errorOutput
Content of the error output for the process.
int getExitCode()
Get the exit code returned by the sub-process.
String getErrorOutput()
Get the content of the error output for the process.
void runProcessInBASH()
Run the process associated with the command from BASH http://www.javaworld.com/javaworld/jw-12-2000/j...
String id
A user-assigned id for this task.
String standardOutput
Content of the standard output for the process.
String getStandardOutput()
Get the content of the standard output for the process.
See http://www.javaworld.com/jw-12-2000/jw-1229-traps.html?page=4.