本文整理了Java中hudson.Util.mapToEnv()
方法的一些代码示例,展示了Util.mapToEnv()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.mapToEnv()
方法的具体详情如下:
包路径:hudson.Util
类名称:Util
方法名:mapToEnv
[英]Converts the map format of the environment variables to the K=V format in the array.
[中]将环境变量的映射格式转换为数组中的K=V格式。
代码示例来源:origin: jenkinsci/jenkins
public LocalProc(String[] cmd, Map<String,String> env,InputStream in, OutputStream out) throws IOException {
this(cmd,Util.mapToEnv(env),in,out);
}
代码示例来源:origin: jenkinsci/jenkins
public LocalProc(String cmd, Map<String,String> env, OutputStream out, File workDir) throws IOException {
this(cmd,Util.mapToEnv(env),out,workDir);
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Sets the environment variable overrides.
*
* <p>
* In addition to what the current process
* is inherited (if this is going to be launched from a agent agent, that
* becomes the "current" process), these variables will be also set.
*
* @param overrides Environment variables to be overridden
* @return {@code this}
*/
public ProcStarter envs(@Nonnull Map<String, String> overrides) {
this.envs = Util.mapToEnv(overrides);
return this;
}
代码示例来源:origin: jenkinsci/jenkins
/**
* @deprecated as of 1.311
* Use {@link #launch()} and its associated builder pattern
*/
@Deprecated
public final Proc launch(String cmd, Map<String,String> env, OutputStream out, FilePath workDir) throws IOException {
return launch(cmd,Util.mapToEnv(env),out,workDir);
}
代码示例来源:origin: jenkinsci/jenkins
/**
* @deprecated as of 1.311
* Use {@link #launch()} and its associated builder pattern
*/
@Deprecated
public final Proc launch(String[] cmd, Map<String, String> env, OutputStream out, FilePath workDir) throws IOException {
return launch(cmd, Util.mapToEnv(env), out, workDir);
}
代码示例来源:origin: jenkinsci/jenkins
/**
* @deprecated as of 1.311
* Use {@link #launch()} and its associated builder pattern
*/
@Deprecated
public final Proc launch(String[] cmd, Map<String, String> env, InputStream in, OutputStream out) throws IOException {
return launch(cmd, Util.mapToEnv(env), in, out);
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Launch a command with optional censoring of arguments from the listener (Note: <strong>The censored portions will
* remain visible through /proc, pargs, process explorer, etc. i.e. people logged in on the same machine</strong>
* This version of the launch command just ensures that it is not visible from a build log which is exposed via the
* web)
*
* @param cmd The command and all it's arguments.
* @param mask Which of the command and arguments should be masked from the listener
* @param env Environment variable overrides.
* @param out stdout and stderr of the process will be sent to this stream. the stream won't be closed.
* @param workDir null if the working directory could be anything.
* @return The process of the command.
* @throws IOException When there are IO problems.
*
* @deprecated as of 1.311
* Use {@link #launch()} and its associated builder pattern
*/
@Deprecated
public final Proc launch(String[] cmd, boolean[] mask, Map<String, String> env, OutputStream out, FilePath workDir) throws IOException {
return launch(cmd, mask, Util.mapToEnv(env), out, workDir);
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Launch a command with optional censoring of arguments from the listener (Note: <strong>The censored portions will
* remain visible through /proc, pargs, process explorer, etc. i.e. people logged in on the same machine</strong>
* This version of the launch command just ensures that it is not visible from a build log which is exposed via the
* web)
*
* @param cmd The command and all it's arguments.
* @param mask Which of the command and arguments should be masked from the listener
* @param env Environment variable overrides.
* @param in null if there's no input.
* @param out stdout and stderr of the process will be sent to this stream. the stream won't be closed.
* @return The process of the command.
* @throws IOException When there are IO problems.
*
* @deprecated as of 1.311
* Use {@link #launch()} and its associated builder pattern
*/
@Deprecated
public final Proc launch(String[] cmd, boolean[] mask, Map<String, String> env, InputStream in, OutputStream out) throws IOException {
return launch(cmd, mask, Util.mapToEnv(env), in, out);
}
代码示例来源:origin: jenkinsci/jenkins
public OutputStream call() throws IOException {
Process p = Runtime.getRuntime().exec(cmd,
Util.mapToEnv(inherit(envOverrides)),
workDir == null ? null : new File(workDir));
List<String> cmdLines = Arrays.asList(cmd);
new StreamCopyThread("stdin copier for remote agent on "+cmdLines,
p.getInputStream(), out.getOut()).start();
new StreamCopyThread("stderr copier for remote agent on "+cmdLines,
p.getErrorStream(), err).start();
// TODO: don't we need to join?
return new RemoteOutputStream(p.getOutputStream());
}
代码示例来源:origin: jenkinsci/jenkins
@Override
public Proc launch(ProcStarter starter) throws IOException {
EnvVars e = new EnvVars(env);
if (starter.envs!=null) {
for (String env : starter.envs) {
e.addLine(env);
}
}
starter.envs = Util.mapToEnv(e);
return outer.launch(starter);
}
代码示例来源:origin: jenkinsci/jenkins
@Override
public Proc launch(ProcStarter ps) throws IOException {
if (!ps.quiet) {
maskedPrintCommandLine(ps.commands, ps.masks, ps.pwd);
}
EnvVars jobEnv = inherit(ps.envs);
// replace variables in command line
String[] jobCmd = new String[ps.commands.size()];
for ( int idx = 0 ; idx < jobCmd.length; idx++ )
jobCmd[idx] = jobEnv.expand(ps.commands.get(idx));
return new LocalProc(jobCmd, Util.mapToEnv(jobEnv),
ps.reverseStdin ?LocalProc.SELFPUMP_INPUT:ps.stdin,
ps.reverseStdout?LocalProc.SELFPUMP_OUTPUT:ps.stdout,
ps.reverseStderr?LocalProc.SELFPUMP_OUTPUT:ps.stderr,
toFile(ps.pwd));
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* @deprecated as of 1.311
* Use {@link #launch()} and its associated builder pattern
*/
@Deprecated
public final Proc launch(String cmd, Map<String,String> env, OutputStream out, FilePath workDir) throws IOException {
return launch(cmd,Util.mapToEnv(env),out,workDir);
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* @deprecated as of 1.311
* Use {@link #launch()} and its associated builder pattern
*/
@Deprecated
public final Proc launch(String[] cmd, Map<String, String> env, InputStream in, OutputStream out) throws IOException {
return launch(cmd, Util.mapToEnv(env), in, out);
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-core
/**
* @deprecated as of 1.311
* Use {@link #launch()} and its associated builder pattern
*/
public final Proc launch(String cmd, Map<String,String> env, OutputStream out, FilePath workDir) throws IOException {
return launch(cmd,Util.mapToEnv(env),out,workDir);
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-core
/**
* Sets the environment variable overrides.
*
* <p>
* In adition to what the current process
* is inherited (if this is going to be launched from a slave agent, that
* becomes the "current" process), these variables will be also set.
*/
public ProcStarter envs(Map<String, String> overrides) {
return envs(Util.mapToEnv(overrides));
}
代码示例来源:origin: org.eclipse.hudson/hudson-core
/**
* Sets the environment variable overrides.
*
* <p> In adition to what the current process is inherited (if this is
* going to be launched from a slave agent, that becomes the "current"
* process), these variables will be also set.
*/
public ProcStarter envs(Map<String, String> overrides) {
return envs(Util.mapToEnv(overrides));
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-core
/**
* @deprecated as of 1.311
* Use {@link #launch()} and its associated builder pattern
*/
public final Proc launch(String[] cmd, Map<String, String> env, InputStream in, OutputStream out) throws IOException {
return launch(cmd, Util.mapToEnv(env), in, out);
}
代码示例来源:origin: org.eclipse.hudson/hudson-core
/**
* @deprecated as of 1.311 Use {@link #launch()} and its associated builder
* pattern
*/
public final Proc launch(String[] cmd, Map<String, String> env, OutputStream out, FilePath workDir) throws IOException {
return launch(cmd, Util.mapToEnv(env), out, workDir);
}
代码示例来源:origin: org.eclipse.hudson/hudson-core
/**
* @deprecated as of 1.311 Use {@link #launch()} and its associated builder
* pattern
*/
public final Proc launch(String cmd, Map<String, String> env, OutputStream out, FilePath workDir) throws IOException {
return launch(cmd, Util.mapToEnv(env), out, workDir);
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
public OutputStream call() throws IOException {
Process p = Runtime.getRuntime().exec(cmd,
Util.mapToEnv(inherit(envOverrides)),
workDir == null ? null : new File(workDir));
List<String> cmdLines = Arrays.asList(cmd);
new StreamCopyThread("stdin copier for remote agent on "+cmdLines,
p.getInputStream(), out.getOut()).start();
new StreamCopyThread("stderr copier for remote agent on "+cmdLines,
p.getErrorStream(), err).start();
// TODO: don't we need to join?
return new RemoteOutputStream(p.getOutputStream());
}
内容来源于网络,如有侵权,请联系作者删除!