public static Process createAndStartProcessIntern(File log,String target,String... args) throws IOException {
  ProcessBuilder pb=new ProcessBuilder(args);
  pb.directory(new File(target));
  EnvironmentVariableUtils.inheritNodeJsPathEnvVariableUtils(pb);
  pb.redirectErrorStream(true);
  pb.redirectOutput(Redirect.to(log));
  Process p=pb.start();
  assert pb.redirectInput() == Redirect.PIPE;
  assert pb.redirectOutput().file() == log;
  assert p.getInputStream().read() == -1;
  return p;
}

public static Process createAndStartProcessIntern ( File log , String target , String ... args ) throws IOException { ProcessBuilder pb = new ProcessBuilder ( args ) ; pb . directory ( new File ( target ) ) ; EnvironmentVariableUtils . inheritNodeJsPathEnvVariableUtils ( pb ) ; pb . redirectErrorStream ( true ) ; pb . redirectOutput ( Redirect . to ( log ) ) ; Process p = pb . start ( ) ; assert pb . redirectInput ( ) == Redirect . PIPE ; assert pb . redirectOutput ( ) . file ( ) == log ; assert p . getInputStream ( ) . read ( ) == - 1 ; return p ; }
helper to create any process based on args and redirecting output to log . the process is started in the target - folder .
