コード例 #1
0
ファイル: Worker.java プロジェクト: aehlig/bazel
  void createProcess() throws IOException {
    String[] command = workerKey.getArgs().toArray(new String[0]);

    // Follows the logic of {@link com.google.devtools.build.lib.shell.Command}.
    File executable = new File(command[0]);
    if (!executable.isAbsolute() && executable.getParent() != null) {
      command[0] = new File(workDir.getPathFile(), command[0]).getAbsolutePath();
    }
    ProcessBuilder processBuilder =
        new ProcessBuilder(command)
            .directory(workDir.getPathFile())
            .redirectError(Redirect.appendTo(logFile.getPathFile()));
    processBuilder.environment().clear();
    processBuilder.environment().putAll(workerKey.getEnv());

    this.process = processBuilder.start();
  }
コード例 #2
0
ファイル: CommandBuilder.java プロジェクト: XClouded/bazel
 public CommandBuilder setWorkingDir(Path path) {
   Preconditions.checkNotNull(path);
   workingDir = path.getPathFile();
   return this;
 }