当前位置: 首页>>代码示例>>Java>>正文


Java ProcessOutput.getStdoutLines方法代码示例

本文整理汇总了Java中com.intellij.execution.process.ProcessOutput.getStdoutLines方法的典型用法代码示例。如果您正苦于以下问题:Java ProcessOutput.getStdoutLines方法的具体用法?Java ProcessOutput.getStdoutLines怎么用?Java ProcessOutput.getStdoutLines使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.execution.process.ProcessOutput的用法示例。


在下文中一共展示了ProcessOutput.getStdoutLines方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getTestsOutput

import com.intellij.execution.process.ProcessOutput; //导入方法依赖的package包/类
@NotNull
public TestsOutput getTestsOutput(@NotNull final ProcessOutput processOutput) {
  String congratulations = "Congratulations!";
  for (String line : processOutput.getStdoutLines()) {
    if (line.startsWith(ourStudyPrefix)) {
      if (line.contains(TEST_OK)) {
        continue;
      }

      if (line.contains(CONGRATS_MESSAGE)) {
        congratulations = line.substring(line.indexOf(CONGRATS_MESSAGE) + CONGRATS_MESSAGE.length());
      }

      if (line.contains(TEST_FAILED)) {
        return new TestsOutput(false, line.substring(line.indexOf(TEST_FAILED) + TEST_FAILED.length()));
      }
    }
  }

  return new TestsOutput(true, congratulations);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:StudyTestRunner.java

示例2: getNimVersion

import com.intellij.execution.process.ProcessOutput; //导入方法依赖的package包/类
private static String getNimVersion(String binPath) {
    try {
        ProcessOutput out = CommandLineUtils.runCommand(binPath, "nim", "--version");
        List<String> stdoutLines = out.getStdoutLines();
        final String marker = "Nim Compiler Version ";
        for (String line : stdoutLines) {
            if (line.startsWith(marker)) {
                return line.substring(marker.length(), line.indexOf(" ", marker.length() + 1));
            }
        }
    } catch (Exception e) {
        return null;
    }

    return null;
}
 
开发者ID:rokups,项目名称:intelli-nim,代码行数:17,代码来源:NimCommandLineUtils.java

示例3: getVersionString

import com.intellij.execution.process.ProcessOutput; //导入方法依赖的package包/类
@Nullable
@Override
public String getVersionString(String sdkHome)
{
	List<String> args = new ArrayList<String>(2);
	args.add(getExecutable(sdkHome));
	args.add("-version");
	try
	{
		ProcessOutput processOutput = ExecUtil.execAndGetOutput(args, sdkHome);
		for(String s : processOutput.getStdoutLines())
		{
			if(s.startsWith("ikvm"))
			{
				return s.substring(5, s.length()).trim();
			}
		}
	}
	catch(ExecutionException e)
	{
		return null;
	}
	return null;
}
 
开发者ID:consulo,项目名称:consulo-ikvm,代码行数:25,代码来源:IkvmBundleType.java

示例4: runDetectionScript

import com.intellij.execution.process.ProcessOutput; //导入方法依赖的package包/类
/**
 * Runs detection script
 *
 * @param executablePath executable to run script with
 * @param detectionScriptPath file containing detection script
 * @return lines from stdout
 * @throws ExecutionException if there was an error during execution
 */
List<String> runDetectionScript(@NotNull final String executablePath, @NotNull final String detectionScriptPath) throws ExecutionException {
  final GeneralCommandLine cl = new GeneralCommandLine();
  cl.setExePath(executablePath);
  cl.addParameter("-NoProfile");
  cl.addParameter("-File");
  cl.addParameter(detectionScriptPath);
  if (LOG.isDebugEnabled()) {
    LOG.debug("Running detection script using command line: " + cl.getCommandLineString());
  }
  final ProcessOutput execResult = runProcess(cl);
  return execResult.getStdoutLines();
}
 
开发者ID:JetBrains,项目名称:teamcity-powershell,代码行数:21,代码来源:DetectionRunner.java

示例5: getTestsOutput

import com.intellij.execution.process.ProcessOutput; //导入方法依赖的package包/类
@NotNull
public static TestsOutput getTestsOutput(@NotNull final ProcessOutput processOutput, final boolean isAdaptive) {
  String congratulations = CONGRATULATIONS;
  final List<String> lines = processOutput.getStdoutLines();
  for (int i = 0; i < lines.size(); i++) {
    final String line = lines.get(i);
    if (line.startsWith(STUDY_PREFIX)) {
      if (line.contains(TEST_OK)) {
        continue;
      }

      if (line.contains(CONGRATS_MESSAGE)) {
        congratulations = line.substring(line.indexOf(CONGRATS_MESSAGE) + CONGRATS_MESSAGE.length());
      }

      if (line.contains(TEST_FAILED)) {
        if (!isAdaptive) {
          return new TestsOutput(false, line.substring(line.indexOf(TEST_FAILED) + TEST_FAILED.length()));
        }
        else {
          final StringBuilder builder = new StringBuilder(line.substring(line.indexOf(TEST_FAILED) + TEST_FAILED.length()) + "\n");
          for (int j = i + 1; j < lines.size(); j++) {
            final String failedTextLine = lines.get(j);
            if (!failedTextLine.contains(STUDY_PREFIX) || !failedTextLine.contains(CONGRATS_MESSAGE)) {
              builder.append(failedTextLine);
              builder.append("\n");
            }
            else {
              break;
            }
          }
          return new TestsOutput(false, builder.toString());
        }          
      }
    }
  }

  return new TestsOutput(true, congratulations);
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:40,代码来源:StudyTestsOutputParser.java

示例6: doAnnotate

import com.intellij.execution.process.ProcessOutput; //导入方法依赖的package包/类
@Nullable
@Override
public Results doAnnotate(State collectedInfo) {
  if (collectedInfo == null) return null;
  ArrayList<String> options = Lists.newArrayList();

  if (collectedInfo.ignoredErrors.size() > 0) {
    options.add("--ignore=" + StringUtil.join(collectedInfo.ignoredErrors, ","));
  }
  options.add("--max-line-length=" + collectedInfo.margin);
  options.add("-");

  GeneralCommandLine cmd = PythonHelper.PEP8.newCommandLine(collectedInfo.interpreterPath, options);

  ProcessOutput output = PySdkUtil.getProcessOutput(cmd, new File(collectedInfo.interpreterPath).getParent(),
                                                    ImmutableMap.of("PYTHONBUFFERED", "1"),
                                                    10000,
                                                    collectedInfo.fileText.getBytes(), false);

  Results results = new Results(collectedInfo.level);
  if (output.isTimeout()) {
    LOG.info("Timeout running pep8.py");
  }
  else if (output.getStderrLines().isEmpty()) {
    for (String line : output.getStdoutLines()) {
      final Problem problem = parseProblem(line);
      if (problem != null) {
        results.problems.add(problem);
      }
    }
  }
  else if (((ApplicationInfoImpl) ApplicationInfo.getInstance()).isEAP()) {
    LOG.info("Error running pep8.py: " + output.getStderr());
  }
  return results;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:37,代码来源:Pep8ExternalAnnotator.java

示例7: getSysPathsFromScript

import com.intellij.execution.process.ProcessOutput; //导入方法依赖的package包/类
@NotNull
public static List<String> getSysPathsFromScript(@NotNull String binaryPath) throws InvalidSdkException {
  // to handle the situation when PYTHONPATH contains ., we need to run the syspath script in the
  // directory of the script itself - otherwise the dir in which we run the script (e.g. /usr/bin) will be added to SDK path
  GeneralCommandLine cmd = PythonHelper.SYSPATH.newCommandLine(binaryPath, Lists.<String>newArrayList());
  final ProcessOutput runResult = PySdkUtil.getProcessOutput(cmd, new File(binaryPath).getParent(),
                                                              getVirtualEnvExtraEnv(binaryPath), MINUTE);
  if (!runResult.checkSuccess(LOG)) {
    throw new InvalidSdkException(String.format("Failed to determine Python's sys.path value:\nSTDOUT: %s\nSTDERR: %s",
                                                runResult.getStdout(),
                                                runResult.getStderr()));
  }
  return runResult.getStdoutLines();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:PythonSdkType.java

示例8: updateChannels

import com.intellij.execution.process.ProcessOutput; //导入方法依赖的package包/类
public void updateChannels() {
  final String condaPython = getCondaPython();
  if (condaPython == null) return;
  final String path = PythonHelpersLocator.getHelperPath("conda_packaging_tool.py");
  final String runDirectory = new File(condaPython).getParent();
  final ProcessOutput output = PySdkUtil.getProcessOutput(runDirectory, new String[]{condaPython, path, "channels"});
  if (output.getExitCode() != 0) return;
  final List<String> lines = output.getStdoutLines();
  for (String line : lines) {
    CONDA_CHANNELS.add(line);
  }
  LAST_TIME_CHECKED = System.currentTimeMillis();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:PyCondaPackageService.java

示例9: getSdkVersion

import com.intellij.execution.process.ProcessOutput; //导入方法依赖的package包/类
@Nullable
public String getSdkVersion(String sdkHome, String executableName) {
    File compilerFolder = new File(sdkHome);
    File compilerFile = new File(sdkHome, executableName);

    GeneralCommandLine commandLine = new GeneralCommandLine();
    commandLine.withWorkDirectory(compilerFolder.getAbsolutePath());
    commandLine.setExePath(compilerFile.getAbsolutePath());

    ProcessOutput output = null;
    try {
        output = new CapturingProcessHandler(commandLine.createProcess(), Charset.defaultCharset(),
                commandLine.getCommandLineString()).runProcess();
    } catch (ExecutionException e) {
        return null;
    }

    //Parse output of a DMD compiler
    List<String> outputLines = output.getStdoutLines();
    if(outputLines.size()>0) {
        String firstLine = outputLines.get(0).trim(); // line in format: "DMD32 D Compiler v2.058"
        Pattern pattern = Pattern.compile(".*v(\\d+\\.\\d+).*");
        Matcher m = pattern.matcher(firstLine);
        if(m.matches()) {
            return m.group(1);
        }
    }

    return null;
}
 
开发者ID:shekn-itrtch,项目名称:DLangPlugin,代码行数:31,代码来源:DLangSdkType.java


注:本文中的com.intellij.execution.process.ProcessOutput.getStdoutLines方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。