hudson.Launcher.launch()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(220)

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

Launcher.launch介绍

[英]Launches a process by using a ProcStarter to configure the parameters.
[中]通过使用ProcStarter来配置参数来启动进程。

代码示例

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * Starts the new process as configured.
  3. */
  4. public Proc start() throws IOException {
  5. return launch(this);
  6. }

代码示例来源:origin: jenkinsci/jenkins

  1. @Override
  2. public Proc launch(ProcStarter starter) throws IOException {
  3. return inner.launch(starter);
  4. }

代码示例来源:origin: jenkinsci/jenkins

  1. @Override
  2. public Proc launch(String[] cmd, boolean[] mask, String[] env, InputStream in, OutputStream out, FilePath workDir) throws IOException {
  3. return inner.launch(cmd, mask, env, in, out, workDir);
  4. }

代码示例来源:origin: jenkinsci/jenkins

  1. @Override
  2. public Proc launch(String[] cmd, String[] env, InputStream in, OutputStream out, FilePath workDir) throws IOException {
  3. return inner.launch(cmd, env, in, out, workDir);
  4. }

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * @deprecated as of 1.311
  3. * Use {@link #launch()} and its associated builder pattern
  4. */
  5. @Deprecated
  6. public final Proc launch(String[] cmd, String[] env, OutputStream out, FilePath workDir) throws IOException {
  7. return launch(cmd, env, null, out, workDir);
  8. }

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * @deprecated as of 1.311
  3. * Use {@link #launch()} and its associated builder pattern
  4. */
  5. @Deprecated
  6. public final Proc launch(String[] cmd, String[] env, InputStream in, OutputStream out) throws IOException {
  7. return launch(cmd, env, in, out, null);
  8. }

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * Launch a command with optional censoring of arguments from the listener (Note: <strong>The censored portions will
  3. * remain visible through /proc, pargs, process explorer, etc. i.e. people logged in on the same machine</strong>
  4. * This version of the launch command just ensures that it is not visible from a build log which is exposed via the
  5. * web)
  6. *
  7. * @param cmd The command and all it's arguments.
  8. * @param mask Which of the command and arguments should be masked from the listener
  9. * @param env Environment variable overrides.
  10. * @param in null if there's no input.
  11. * @param out stdout and stderr of the process will be sent to this stream. the stream won't be closed.
  12. * @return The process of the command.
  13. * @throws IOException When there are IO problems.
  14. *
  15. * @deprecated as of 1.311
  16. * Use {@link #launch()} and its associated builder pattern
  17. */
  18. @Deprecated
  19. public final Proc launch(String[] cmd, boolean[] mask, String[] env, InputStream in, OutputStream out) throws IOException {
  20. return launch(cmd, mask, env, in, out, null);
  21. }

代码示例来源:origin: jenkinsci/jenkins

  1. @Override
  2. public Proc launch(ProcStarter starter) throws IOException {
  3. starter.commands.addAll(0,Arrays.asList(prefix));
  4. boolean[] masks = starter.masks;
  5. if (masks != null) {
  6. starter.masks = prefix(masks);
  7. }
  8. return outer.launch(starter);
  9. }

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * @deprecated as of 1.311
  3. * Use {@link #launch()} and its associated builder pattern
  4. */
  5. @Deprecated
  6. public final Proc launch(String[] cmd, Map<String, String> env, OutputStream out, FilePath workDir) throws IOException {
  7. return launch(cmd, Util.mapToEnv(env), out, workDir);
  8. }

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * @deprecated as of 1.311
  3. * Use {@link #launch()} and its associated builder pattern
  4. */
  5. @Deprecated
  6. public final Proc launch(String[] cmd, Map<String, String> env, InputStream in, OutputStream out) throws IOException {
  7. return launch(cmd, Util.mapToEnv(env), in, out);
  8. }

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * @deprecated as of 1.311
  3. * Use {@link #launch()} and its associated builder pattern
  4. */
  5. @Deprecated
  6. public final Proc launch(String cmd,String[] env,OutputStream out, FilePath workDir) throws IOException {
  7. return launch(Util.tokenize(cmd),env,out,workDir);
  8. }

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * @deprecated as of 1.311
  3. * Use {@link #launch()} and its associated builder pattern
  4. */
  5. @Deprecated
  6. public final Proc launch(String cmd, Map<String,String> env, OutputStream out, FilePath workDir) throws IOException {
  7. return launch(cmd,Util.mapToEnv(env),out,workDir);
  8. }

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * Launch a command with optional censoring of arguments from the listener (Note: <strong>The censored portions will
  3. * remain visible through /proc, pargs, process explorer, etc. i.e. people logged in on the same machine</strong>
  4. * This version of the launch command just ensures that it is not visible from a build log which is exposed via the
  5. * web)
  6. *
  7. * @param cmd The command and all it's arguments.
  8. * @param mask Which of the command and arguments should be masked from the listener
  9. * @param env Environment variable overrides.
  10. * @param in null if there's no input.
  11. * @param out stdout and stderr of the process will be sent to this stream. the stream won't be closed.
  12. * @return The process of the command.
  13. * @throws IOException When there are IO problems.
  14. *
  15. * @deprecated as of 1.311
  16. * Use {@link #launch()} and its associated builder pattern
  17. */
  18. @Deprecated
  19. public final Proc launch(String[] cmd, boolean[] mask, Map<String, String> env, InputStream in, OutputStream out) throws IOException {
  20. return launch(cmd, mask, Util.mapToEnv(env), in, out);
  21. }

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * Launch a command with optional censoring of arguments from the listener (Note: <strong>The censored portions will
  3. * remain visible through /proc, pargs, process explorer, etc. i.e. people logged in on the same machine</strong>
  4. * This version of the launch command just ensures that it is not visible from a build log which is exposed via the
  5. * web)
  6. *
  7. * @param cmd The command and all it's arguments.
  8. * @param mask Which of the command and arguments should be masked from the listener
  9. * @param env Environment variable overrides.
  10. * @param out stdout and stderr of the process will be sent to this stream. the stream won't be closed.
  11. * @param workDir null if the working directory could be anything.
  12. * @return The process of the command.
  13. * @throws IOException When there are IO problems.
  14. *
  15. * @deprecated as of 1.311
  16. * Use {@link #launch()} and its associated builder pattern
  17. */
  18. @Deprecated
  19. public final Proc launch(String[] cmd, boolean[] mask, Map<String, String> env, OutputStream out, FilePath workDir) throws IOException {
  20. return launch(cmd, mask, Util.mapToEnv(env), out, workDir);
  21. }

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * Primarily invoked from {@link ProcStarter#start()} to start a process with a specific launcher.
  3. */
  4. public abstract Proc launch(@Nonnull ProcStarter starter) throws IOException;

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * @param env
  3. * Environment variable overrides.
  4. * @param in
  5. * null if there's no input.
  6. * @param workDir
  7. * null if the working directory could be anything.
  8. * @param out
  9. * stdout and stderr of the process will be sent to this stream.
  10. * the stream won't be closed.
  11. *
  12. * @deprecated as of 1.311
  13. * Use {@link #launch()} and its associated builder pattern
  14. */
  15. @Deprecated
  16. public Proc launch(String[] cmd, String[] env, InputStream in, OutputStream out, FilePath workDir) throws IOException {
  17. return launch(launch().cmds(cmd).envs(env).stdin(in).stdout(out).pwd(workDir));
  18. }

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * Fills a {@link ProcStarter} with all the parameters configured by this builder.
  3. */
  4. public ProcStarter launch(Launcher launcher) {
  5. return launcher.launch().cmds(toFullArguments()).pwd(pwd);
  6. }

代码示例来源:origin: jenkinsci/jenkins

  1. @Override
  2. public Proc launch(ProcStarter starter) throws IOException {
  3. EnvVars e = new EnvVars(env);
  4. if (starter.envs!=null) {
  5. for (String env : starter.envs) {
  6. e.addLine(env);
  7. }
  8. }
  9. starter.envs = Util.mapToEnv(e);
  10. return outer.launch(starter);
  11. }

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * Checks if "java" is in PATH on the given node.
  3. *
  4. * <p>
  5. * If it's not, then the user must specify a configured JDK,
  6. * so this is often useful for form field validation.
  7. */
  8. public static boolean isDefaultJDKValid(Node n) {
  9. try {
  10. TaskListener listener = new StreamTaskListener(new NullStream());
  11. Launcher launcher = n.createLauncher(listener);
  12. return launcher.launch().cmds("java","-fullversion").stdout(listener).join()==0;
  13. } catch (IOException e) {
  14. return false;
  15. } catch (InterruptedException e) {
  16. return false;
  17. }
  18. }

代码示例来源:origin: jenkinsci/jenkins

  1. @Override
  2. public FilePath performInstallation(ToolInstallation tool, Node node, TaskListener log) throws IOException, InterruptedException {
  3. FilePath dir = preferredLocation(tool, node);
  4. // TODO support Unix scripts with interpreter line (see Shell.buildCommandLine)
  5. FilePath script = dir.createTextTempFile("hudson", getCommandFileExtension(), command);
  6. try {
  7. String cmd[] = getCommandCall(script);
  8. int r = node.createLauncher(log).launch().cmds(cmd).stdout(log).pwd(dir).join();
  9. if (r != 0) {
  10. throw new IOException("Command returned status " + r);
  11. }
  12. } finally {
  13. script.delete();
  14. }
  15. return dir.child(getToolHome());
  16. }

相关文章