hudson.Util.mapToEnv()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(8.1k)|赞(0)|评价(0)|浏览(176)

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

Util.mapToEnv介绍

[英]Converts the map format of the environment variables to the K=V format in the array.
[中]将环境变量的映射格式转换为数组中的K=V格式。

代码示例

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

  1. public LocalProc(String[] cmd, Map<String,String> env,InputStream in, OutputStream out) throws IOException {
  2. this(cmd,Util.mapToEnv(env),in,out);
  3. }

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

  1. public LocalProc(String cmd, Map<String,String> env, OutputStream out, File workDir) throws IOException {
  2. this(cmd,Util.mapToEnv(env),out,workDir);
  3. }

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

  1. /**
  2. * Sets the environment variable overrides.
  3. *
  4. * <p>
  5. * In addition to what the current process
  6. * is inherited (if this is going to be launched from a agent agent, that
  7. * becomes the "current" process), these variables will be also set.
  8. *
  9. * @param overrides Environment variables to be overridden
  10. * @return {@code this}
  11. */
  12. public ProcStarter envs(@Nonnull Map<String, String> overrides) {
  13. this.envs = Util.mapToEnv(overrides);
  14. return this;
  15. }

代码示例来源: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, 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. * 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. * 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. public OutputStream call() throws IOException {
  2. Process p = Runtime.getRuntime().exec(cmd,
  3. Util.mapToEnv(inherit(envOverrides)),
  4. workDir == null ? null : new File(workDir));
  5. List<String> cmdLines = Arrays.asList(cmd);
  6. new StreamCopyThread("stdin copier for remote agent on "+cmdLines,
  7. p.getInputStream(), out.getOut()).start();
  8. new StreamCopyThread("stderr copier for remote agent on "+cmdLines,
  9. p.getErrorStream(), err).start();
  10. // TODO: don't we need to join?
  11. return new RemoteOutputStream(p.getOutputStream());
  12. }

代码示例来源: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. @Override
  2. public Proc launch(ProcStarter ps) throws IOException {
  3. if (!ps.quiet) {
  4. maskedPrintCommandLine(ps.commands, ps.masks, ps.pwd);
  5. }
  6. EnvVars jobEnv = inherit(ps.envs);
  7. // replace variables in command line
  8. String[] jobCmd = new String[ps.commands.size()];
  9. for ( int idx = 0 ; idx < jobCmd.length; idx++ )
  10. jobCmd[idx] = jobEnv.expand(ps.commands.get(idx));
  11. return new LocalProc(jobCmd, Util.mapToEnv(jobEnv),
  12. ps.reverseStdin ?LocalProc.SELFPUMP_INPUT:ps.stdin,
  13. ps.reverseStdout?LocalProc.SELFPUMP_OUTPUT:ps.stdout,
  14. ps.reverseStderr?LocalProc.SELFPUMP_OUTPUT:ps.stderr,
  15. toFile(ps.pwd));
  16. }

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

  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: org.jenkins-ci.main/jenkins-core

  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: org.jvnet.hudson.main/hudson-core

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

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

  1. /**
  2. * Sets the environment variable overrides.
  3. *
  4. * <p>
  5. * In adition to what the current process
  6. * is inherited (if this is going to be launched from a slave agent, that
  7. * becomes the "current" process), these variables will be also set.
  8. */
  9. public ProcStarter envs(Map<String, String> overrides) {
  10. return envs(Util.mapToEnv(overrides));
  11. }

代码示例来源:origin: org.eclipse.hudson/hudson-core

  1. /**
  2. * Sets the environment variable overrides.
  3. *
  4. * <p> In adition to what the current process is inherited (if this is
  5. * going to be launched from a slave agent, that becomes the "current"
  6. * process), these variables will be also set.
  7. */
  8. public ProcStarter envs(Map<String, String> overrides) {
  9. return envs(Util.mapToEnv(overrides));
  10. }

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

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

代码示例来源:origin: org.eclipse.hudson/hudson-core

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

代码示例来源:origin: org.eclipse.hudson/hudson-core

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

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

  1. public OutputStream call() throws IOException {
  2. Process p = Runtime.getRuntime().exec(cmd,
  3. Util.mapToEnv(inherit(envOverrides)),
  4. workDir == null ? null : new File(workDir));
  5. List<String> cmdLines = Arrays.asList(cmd);
  6. new StreamCopyThread("stdin copier for remote agent on "+cmdLines,
  7. p.getInputStream(), out.getOut()).start();
  8. new StreamCopyThread("stderr copier for remote agent on "+cmdLines,
  9. p.getErrorStream(), err).start();
  10. // TODO: don't we need to join?
  11. return new RemoteOutputStream(p.getOutputStream());
  12. }

相关文章