org.apache.tools.ant.taskdefs.Execute.setNewenvironment()方法的使用及代码示例

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

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

Execute.setNewenvironment介绍

[英]Set whether to propagate the default environment or not.
[中]设置是否传播默认环境。

代码示例

代码示例来源:origin: org.apache.ant/ant

/**
 * Set up our environment variables.
 * @param exe executable.
 */
private void setupEnvironment(Execute exe) {
  String[] environment = env.getVariables();
  if (environment != null) {
    for (String element : environment) {
      log("Setting environment variable: " + element,
        Project.MSG_VERBOSE);
    }
  }
  exe.setNewenvironment(newEnvironment);
  exe.setEnvironment(environment);
}

代码示例来源:origin: org.apache.ant/ant

exe.setCommandline(getProcEnvCommand());
exe.setNewenvironment(true);
int retval = exe.execute();
if (retval != 0) {

代码示例来源:origin: org.apache.ant/ant

/**
 * Create an Execute instance with the correct working directory set.
 *
 * @return an instance of the Execute class.
 *
 * @throws BuildException under unknown circumstances.
 */
protected Execute prepareExec() throws BuildException {
  // default directory to the project's base directory
  if (dir == null) {
    dir = getProject().getBaseDir();
  }
  if (redirectorElement != null) {
    redirectorElement.configure(redirector);
  }
  Execute exe = new Execute(createHandler(), createWatchdog());
  exe.setAntRun(getProject());
  exe.setWorkingDirectory(dir);
  exe.setVMLauncher(vmLauncher);
  String[] environment = env.getVariables();
  if (environment != null) {
    for (String variable : environment) {
      log("Setting environment variable: " + variable,
          Project.MSG_VERBOSE);
    }
  }
  exe.setNewenvironment(newEnvironment);
  exe.setEnvironment(environment);
  return exe;
}

代码示例来源:origin: org.fitnesse/fitnesse

private int executeRunnerClassAsForked() throws BuildException {
 CommandlineJava cmd = initializeJavaCommand();
 Execute execute = new Execute(new LogStreamHandler(this, Project.MSG_INFO, Project.MSG_WARN));
 String[] commandLine = cmd.getCommandline();
 log("Executing: " + StringUtils.join(Arrays.asList(commandLine), " "));
 execute.setCommandline(commandLine);
 execute.setNewenvironment(false);
 execute.setAntRun(getProject());
 log(cmd.describeCommand(), Project.MSG_VERBOSE);
 int retVal;
 try {
  retVal = execute.execute();
 }
 catch (IOException e) {
  throw new BuildException("Process fork failed.", e, getLocation());
 }
 return retVal;
}

代码示例来源:origin: com.github.tcnh/fitnesse

private int executeRunnerClassAsForked() throws BuildException {
 CommandlineJava cmd = initializeJavaCommand();
 Execute execute = new Execute(new LogStreamHandler(this, Project.MSG_INFO, Project.MSG_WARN));
 String[] commandLine = cmd.getCommandline();
 log("Executing: " + StringUtils.join(Arrays.asList(commandLine), " "));
 execute.setCommandline(commandLine);
 execute.setNewenvironment(false);
 execute.setAntRun(getProject());
 log(cmd.describeCommand(), Project.MSG_VERBOSE);
 int retVal;
 try {
  retVal = execute.execute();
 }
 catch (IOException e) {
  throw new BuildException("Process fork failed.", e, getLocation());
 }
 return retVal;
}

代码示例来源:origin: randomizedtesting/randomizedtesting

execute.setWorkingDirectory(cwd.toFile());
execute.setStreamHandler(streamHandler);
execute.setNewenvironment(newEnvironment);
if (env.getVariables() != null)
 execute.setEnvironment(env.getVariables());

代码示例来源:origin: com.carrotsearch.randomizedtesting/junit4-ant

execute.setWorkingDirectory(cwd.toFile());
execute.setStreamHandler(streamHandler);
execute.setNewenvironment(newEnvironment);
if (env.getVariables() != null)
 execute.setEnvironment(env.getVariables());

代码示例来源:origin: Alexey1Gavrilov/ExpectIt

exec.setNewenvironment(newEnvironment);
exec.setAntRun(getProject());
exec.setWorkingDirectory(original.getWorkingDirectory());

代码示例来源:origin: org.apache.ant/ant-junit

execute.setNewenvironment(newEnvironment);
execute.setEnvironment(environment);

相关文章