當前位置: 首頁>>代碼示例>>Java>>正文


Java GeneralCommandLine.withParentEnvironmentType方法代碼示例

本文整理匯總了Java中com.intellij.execution.configurations.GeneralCommandLine.withParentEnvironmentType方法的典型用法代碼示例。如果您正苦於以下問題:Java GeneralCommandLine.withParentEnvironmentType方法的具體用法?Java GeneralCommandLine.withParentEnvironmentType怎麽用?Java GeneralCommandLine.withParentEnvironmentType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.execution.configurations.GeneralCommandLine的用法示例。


在下文中一共展示了GeneralCommandLine.withParentEnvironmentType方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createAndSetupCmdLine

import com.intellij.execution.configurations.GeneralCommandLine; //導入方法依賴的package包/類
/**
 * Creates process builder and setups it's commandLine, working directory, environment variables
 *
 * @param workingDir         Process working dir
 * @param executablePath     Path to executable file
 * @param arguments          Process commandLine  @return process builder
 */
public static GeneralCommandLine createAndSetupCmdLine(@Nullable final String workingDir,
                                                       @Nullable final Map<String, String> userDefinedEnv,
                                                       final boolean passParentEnv,
                                                       @NotNull final String executablePath,
                                                       @NotNull final String... arguments) {
  GeneralCommandLine cmdLine = new GeneralCommandLine();

  cmdLine.setExePath(toSystemDependentName(executablePath));

  if (workingDir != null) {
    cmdLine.setWorkDirectory(toSystemDependentName(workingDir));
  }

  cmdLine.addParameters(arguments);

  cmdLine.withParentEnvironmentType(passParentEnv ? ParentEnvironmentType.CONSOLE : ParentEnvironmentType.NONE);
  cmdLine.withEnvironment(userDefinedEnv);
  //Inline parent env variables occurrences
  EnvironmentUtil.inlineParentOccurrences(cmdLine.getEnvironment());

  return cmdLine;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:30,代碼來源:ProcessRunner.java

示例2: execute

import com.intellij.execution.configurations.GeneralCommandLine; //導入方法依賴的package包/類
protected synchronized void execute(GeneralCommandLine commandLine) throws AuthenticationException {
  try {
    commandLine.withParentEnvironmentType(ParentEnvironmentType.CONSOLE);
    myProcess = commandLine.createProcess();

    myErrThread = new ReadProcessThread(
      new BufferedReader(new InputStreamReader(myProcess.getErrorStream(), EncodingManager.getInstance().getDefaultCharset()))) {
      protected void textAvailable(String s) {
        myErrorText.append(s);
        myErrorRegistry.registerError(s);
        myContainsError = true;
      }
    };
    final Application application = ApplicationManager.getApplication();
    myStdErrFuture = application.executeOnPooledThread(myErrThread);

    myInputStream = myProcess.getInputStream();
    myOutputStream = myProcess.getOutputStream();

    waitForProcess(application);
  }
  catch (Exception e) {
    closeInternal();
    throw new AuthenticationException(e.getLocalizedMessage(), e);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:27,代碼來源:ConnectionOnProcess.java

示例3: configureCommandLine

import com.intellij.execution.configurations.GeneralCommandLine; //導入方法依賴的package包/類
public void configureCommandLine(@NotNull GeneralCommandLine commandLine, boolean consoleParentEnvs) {
  if (myPassParentEnvs) {
    commandLine.withParentEnvironmentType(consoleParentEnvs ? GeneralCommandLine.ParentEnvironmentType.CONSOLE
                                                            : GeneralCommandLine.ParentEnvironmentType.SYSTEM);
  }
  else {
    commandLine.withParentEnvironmentType(GeneralCommandLine.ParentEnvironmentType.NONE);
  }
  commandLine.withEnvironment(myEnvs);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:11,代碼來源:EnvironmentVariablesData.java

示例4: setupJVMCommandLine

import com.intellij.execution.configurations.GeneralCommandLine; //導入方法依賴的package包/類
public static GeneralCommandLine setupJVMCommandLine(final String exePath,
                                                     final SimpleJavaParameters javaParameters,
                                                     final boolean forceDynamicClasspath) {
  final GeneralCommandLine commandLine = new GeneralCommandLine(exePath);

  final ParametersList vmParametersList = javaParameters.getVMParametersList();
  commandLine.withEnvironment(javaParameters.getEnv());
  commandLine.withParentEnvironmentType(javaParameters.isPassParentEnvs() ? ParentEnvironmentType.CONSOLE : ParentEnvironmentType.NONE);

  final Class commandLineWrapper;
  if ((commandLineWrapper = getCommandLineWrapperClass()) != null) {
    if (forceDynamicClasspath && !vmParametersList.hasParameter("-classpath") && !vmParametersList.hasParameter("-cp")) {
      if (isClassPathJarEnabled(javaParameters, PathUtil.getJarPathForClass(ClassPath.class))) {
        appendJarClasspathParams(javaParameters, commandLine, vmParametersList, commandLineWrapper);
      }
      else {
        appendOldCommandLineWrapper(javaParameters, commandLine, vmParametersList, commandLineWrapper);
      }
    }
    else {
      appendParamsEncodingClasspath(javaParameters, commandLine, vmParametersList);
    }
  }
  else {
    appendParamsEncodingClasspath(javaParameters, commandLine, vmParametersList);
  }

  final String mainClass = javaParameters.getMainClass();
  final String jarPath = javaParameters.getJarPath();
  if (mainClass != null) {
    commandLine.addParameter(mainClass);
  }
  else if (jarPath != null) {
    commandLine.addParameter("-jar");
    commandLine.addParameter(jarPath);
  }

  commandLine.addParameters(javaParameters.getProgramParametersList().getList());

  commandLine.withWorkDirectory(javaParameters.getWorkingDirectory());

  return commandLine;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:44,代碼來源:JdkUtil.java

示例5: createDebugProcess

import com.intellij.execution.configurations.GeneralCommandLine; //導入方法依賴的package包/類
@Override
public CidrDebugProcess createDebugProcess(CommandLineState state, XDebugSession session)
    throws ExecutionException {
  TargetExpression target = configuration.getTarget();
  if (target == null) {
    throw new ExecutionException("Cannot parse run configuration target.");
  }
  if (runner.executableToDebug == null) {
    throw new ExecutionException("No debug binary found.");
  }
  WorkspaceRoot workspaceRoot = WorkspaceRoot.fromProject(project);

  GeneralCommandLine commandLine = new GeneralCommandLine(runner.executableToDebug.getPath());
  File workingDir = workspaceRoot.directory();
  commandLine.setWorkDirectory(workingDir);
  commandLine.addParameters(handlerState.getExeFlagsState().getExpandedFlags());

  EnvironmentVariablesData envState = handlerState.getEnvVarsState().getData();
  commandLine.withParentEnvironmentType(
      envState.isPassParentEnvs() ? ParentEnvironmentType.SYSTEM : ParentEnvironmentType.NONE);
  commandLine.getEnvironment().putAll(envState.getEnvs());

  String testPrefix = "--gtest";
  if (Blaze.getBuildSystem(project).equals(BuildSystem.Blaze)) {
    testPrefix = "--gunit";
  }
  // Disable colored output, to workaround parsing bug (CPP-10054)
  // Note: cc_test runner currently only supports GUnit tests.
  if (Kind.CC_TEST.equals(configuration.getTargetKind())) {
    commandLine.addParameter(testPrefix + "_color=no");
  }

  String testFilter = convertToGUnitTestFilter(handlerState.getTestFilterFlag(), testPrefix);
  if (testFilter != null) {
    commandLine.addParameter(testFilter);
  }

  TrivialInstaller installer = new TrivialInstaller(commandLine);
  ImmutableList<String> startupCommands = getGdbStartupCommands(workingDir);
  CLionRunParameters parameters =
      new CLionRunParameters(
          new BlazeGDBDriverConfiguration(project, startupCommands, workspaceRoot), installer);

  state.setConsoleBuilder(createConsoleBuilder(null));
  state.addConsoleFilters(getConsoleFilters().toArray(new Filter[0]));
  return new CidrLocalDebugProcess(parameters, session, state.getConsoleBuilder());
}
 
開發者ID:bazelbuild,項目名稱:intellij,代碼行數:48,代碼來源:BlazeCidrLauncher.java


注:本文中的com.intellij.execution.configurations.GeneralCommandLine.withParentEnvironmentType方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。