org.eclipse.jgit.util.FS.runProcess()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(4.1k)|赞(0)|评价(0)|浏览(156)

本文整理了Java中org.eclipse.jgit.util.FS.runProcess()方法的一些代码示例,展示了FS.runProcess()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FS.runProcess()方法的具体详情如下:
包路径:org.eclipse.jgit.util.FS
类名称:FS
方法名:runProcess

FS.runProcess介绍

[英]Runs the given process until termination, clearing its stdout and stderr streams on-the-fly.
[中]运行给定进程直到终止,动态清除其stdout和stderr流。

代码示例

代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit

InputStream in = (stdinArgs == null) ? null : new ByteArrayInputStream(
        stdinArgs.getBytes(UTF_8));
return runProcess(processBuilder, outRedirect, errRedirect, in);

代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit

/**
 * Execute a command defined by a {@link java.lang.ProcessBuilder}.
 *
 * @param pb
 *            The command to be executed
 * @param in
 *            The standard input stream passed to the process
 * @return The result of the executed command
 * @throws java.lang.InterruptedException
 * @throws java.io.IOException
 * @since 4.2
 */
public ExecutionResult execute(ProcessBuilder pb, InputStream in)
    throws IOException, InterruptedException {
  try (TemporaryBuffer stdout = new TemporaryBuffer.LocalFile(null);
      TemporaryBuffer stderr = new TemporaryBuffer.Heap(1024,
          1024 * 1024)) {
    int rc = runProcess(pb, stdout, stderr, in);
    return new ExecutionResult(stdout, stderr, rc);
  }
}

代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit

return new ProcessResult(runProcess(hookProcess, outRedirect,
      errRedirect, stdinArgs), Status.OK);
} catch (IOException e) {

代码示例来源:origin: berlam/github-bucket

InputStream in = (stdinArgs == null) ? null : new ByteArrayInputStream(
        stdinArgs.getBytes(UTF_8));
return runProcess(processBuilder, outRedirect, errRedirect, in);

代码示例来源:origin: sonia.jgit/org.eclipse.jgit

InputStream in = (stdinArgs == null) ? null : new ByteArrayInputStream(
    stdinArgs.getBytes(Constants.CHARACTER_ENCODING));
return runProcess(processBuilder, outRedirect, errRedirect, in);

代码示例来源:origin: berlam/github-bucket

/**
 * Execute a command defined by a {@link java.lang.ProcessBuilder}.
 *
 * @param pb
 *            The command to be executed
 * @param in
 *            The standard input stream passed to the process
 * @return The result of the executed command
 * @throws java.lang.InterruptedException
 * @throws java.io.IOException
 * @since 4.2
 */
public ExecutionResult execute(ProcessBuilder pb, InputStream in)
    throws IOException, InterruptedException {
  try (TemporaryBuffer stdout = new TemporaryBuffer.LocalFile(null);
      TemporaryBuffer stderr = new TemporaryBuffer.Heap(1024,
          1024 * 1024)) {
    int rc = runProcess(pb, stdout, stderr, in);
    return new ExecutionResult(stdout, stderr, rc);
  }
}

代码示例来源:origin: berlam/github-bucket

return new ProcessResult(runProcess(hookProcess, outRedirect,
      errRedirect, stdinArgs), Status.OK);
} catch (IOException e) {

代码示例来源:origin: sonia.jgit/org.eclipse.jgit

/**
 * Execute a command defined by a {@link ProcessBuilder}.
 *
 * @param pb
 *            The command to be executed
 * @param in
 *            The standard input stream passed to the process
 * @return The result of the executed command
 * @throws InterruptedException
 * @throws IOException
 * @since 4.2
 */
public ExecutionResult execute(ProcessBuilder pb, InputStream in)
    throws IOException, InterruptedException {
  TemporaryBuffer stdout = new TemporaryBuffer.LocalFile(null);
  TemporaryBuffer stderr = new TemporaryBuffer.Heap(1024, 1024 * 1024);
  try {
    int rc = runProcess(pb, stdout, stderr, in);
    return new ExecutionResult(stdout, stderr, rc);
  } finally {
    stdout.close();
    stderr.close();
  }
}

代码示例来源:origin: sonia.jgit/org.eclipse.jgit

hookProcess.directory(runDirectory);
try {
  return new ProcessResult(runProcess(hookProcess, outRedirect,
      errRedirect, stdinArgs), Status.OK);
} catch (IOException e) {

代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit.lfs

/** {@inheritDoc} */
@Override
public Void call() throws Exception {
  StoredConfig cfg = null;
  if (repository == null) {
    cfg = loadUserConfig();
  } else {
    cfg = repository.getConfig();
  }
  cfg.setBoolean(ConfigConstants.CONFIG_FILTER_SECTION,
      ConfigConstants.CONFIG_SECTION_LFS,
      ConfigConstants.CONFIG_KEY_USEJGITBUILTIN, true);
  cfg.setBoolean(ConfigConstants.CONFIG_FILTER_SECTION,
      ConfigConstants.CONFIG_SECTION_LFS,
      ConfigConstants.CONFIG_KEY_REQUIRED, true);
  cfg.save();
  // try to run git lfs install, we really don't care if it is present
  // and/or works here (yet).
  ProcessBuilder builder = FS.DETECTED.runInShell("git", //$NON-NLS-1$
      repository == null ? ARGS_USER : ARGS_LOCAL);
  if (repository != null) {
    builder.directory(repository.isBare() ? repository.getDirectory()
        : repository.getWorkTree());
  }
  FS.DETECTED.runProcess(builder, null, null, (String) null);
  return null;
}

相关文章