}
}
+ public static void executeWithLog(String command, Logger logger) {
+ BufferedReader input = null;
+ String line = null;
+ Process proc = null;
+ String[] fullCommand = getCommand(command);
+ try {
+ ProcessBuilder pb = new ProcessBuilder();
+ pb.command(fullCommand);
+ proc = pb.start();
+ input = new BufferedReader(new InputStreamReader(proc.getInputStream()));
+ while((line=input.readLine())!=null){
+ logger.info(line);
+ }
+ } catch ( IOException e ) {
+ HostUtil.logger.info( "Exception occurred:", e );
+ } finally{
+ IOUtil.tryClose( input );
+ if(proc!=null) {
+ proc.destroy();
+ }
+ }
+ }
+
public static String returnExecute(String command){
return returnExecute(command, null);