use of com.intellij.execution.process.ProcessOutput in project intellij-community by JetBrains.
the class PythonSdkFlavor method getVersionString.
@Nullable
public String getVersionString(@Nullable String sdkHome) {
if (sdkHome == null) {
return null;
}
final String runDirectory = new File(sdkHome).getParent();
final ProcessOutput processOutput = PySdkUtil.getProcessOutput(runDirectory, new String[] { sdkHome, getVersionOption() }, 10000);
return getVersionStringFromOutput(processOutput);
}
use of com.intellij.execution.process.ProcessOutput in project intellij-community by JetBrains.
the class PySkeletonGenerator method generateBuiltinSkeletons.
public void generateBuiltinSkeletons(@NotNull Sdk sdk) throws InvalidSdkException {
//noinspection ResultOfMethodCallIgnored
new File(mySkeletonsPath).mkdirs();
String binaryPath = sdk.getHomePath();
if (binaryPath == null)
throw new InvalidSdkException("Broken home path for " + sdk.getName());
long startTime = System.currentTimeMillis();
final ProcessOutput runResult = getProcessOutput(new File(binaryPath).getParent(), new String[] { binaryPath, PythonHelpersLocator.getHelperPath(GENERATOR3), // output dir
"-d", // output dir
mySkeletonsPath, // for builtins
"-b" }, PythonSdkType.getVirtualEnvExtraEnv(binaryPath), MINUTE * 5);
runResult.checkSuccess(LOG);
LOG.info("Rebuilding builtin skeletons took " + (System.currentTimeMillis() - startTime) + " ms");
}
use of com.intellij.execution.process.ProcessOutput in project intellij-community by JetBrains.
the class PySkeletonGenerator method generateSkeleton.
protected void generateSkeleton(String modname, String modfilename, List<String> assemblyRefs, String syspath, String sdkHomePath, Consumer<Boolean> resultConsumer) throws InvalidSdkException {
final ProcessOutput genResult = runSkeletonGeneration(modname, modfilename, assemblyRefs, sdkHomePath, syspath);
if (genResult.getStderrLines().size() > 0) {
StringBuilder sb = new StringBuilder("Skeleton for ");
sb.append(modname);
if (genResult.getExitCode() != 0) {
sb.append(" failed on ");
} else {
sb.append(" had some minor errors on ");
}
sb.append(sdkHomePath).append(". stderr: --\n");
for (String err_line : genResult.getStderrLines()) {
sb.append(err_line).append("\n");
}
sb.append("--");
if (ApplicationManagerEx.getApplicationEx().isInternal()) {
LOG.warn(sb.toString());
} else {
LOG.info(sb.toString());
}
}
resultConsumer.consume(genResult.getExitCode() == 0);
}
use of com.intellij.execution.process.ProcessOutput in project intellij-community by JetBrains.
the class PySkeletonGenerator method listBinaries.
@NotNull
public ListBinariesResult listBinaries(@NotNull Sdk sdk, @NotNull String extraSysPath) throws InvalidSdkException {
final String homePath = sdk.getHomePath();
final long startTime = System.currentTimeMillis();
if (homePath == null)
throw new InvalidSdkException("Broken home path for " + sdk.getName());
final String parentDir = new File(homePath).getParent();
List<String> cmd = new ArrayList<>(Arrays.asList(homePath, PythonHelpersLocator.getHelperPath(GENERATOR3), "-v", "-L"));
if (!StringUtil.isEmpty(extraSysPath)) {
cmd.add("-s");
cmd.add(extraSysPath);
}
final ProcessOutput process = getProcessOutput(parentDir, ArrayUtil.toStringArray(cmd), PythonSdkType.getVirtualEnvExtraEnv(homePath), // see PY-3898
MINUTE * 4);
LOG.info("Retrieving binary module list took " + (System.currentTimeMillis() - startTime) + " ms");
if (process.getExitCode() != 0) {
final StringBuilder sb = new StringBuilder("failed to run ").append(GENERATOR3).append(" for ").append(homePath);
if (process.isTimeout()) {
sb.append(": timed out.");
} else {
sb.append(", exit code ").append(process.getExitCode()).append(", stderr: \n-----\n");
for (String line : process.getStderrLines()) {
sb.append(line).append("\n");
}
sb.append("-----");
}
throw new InvalidSdkException(sb.toString());
}
final List<String> lines = process.getStdoutLines();
if (lines.size() < 1) {
throw new InvalidSdkException("Empty output from " + GENERATOR3 + " for " + homePath);
}
final Iterator<String> iter = lines.iterator();
final int generatorVersion = fromVersionString(iter.next().trim());
final Map<String, PySkeletonRefresher.PyBinaryItem> binaries = Maps.newHashMap();
while (iter.hasNext()) {
final String line = iter.next();
int cutpos = line.indexOf('\t');
if (cutpos >= 0) {
String[] strs = line.split("\t");
String moduleName = strs[0];
String path = strs[1];
int length = Integer.parseInt(strs[2]);
int lastModified = Integer.parseInt(strs[3]);
binaries.put(moduleName, new PySkeletonRefresher.PyBinaryItem(moduleName, path, length, lastModified));
} else {
// but don't die yet
LOG.error("Bad binaries line: '" + line + "', SDK " + homePath);
}
}
return new ListBinariesResult(generatorVersion, binaries);
}
use of com.intellij.execution.process.ProcessOutput in project intellij-community by JetBrains.
the class SvnRenameTest method testRenameReplace.
// IDEADEV-18844
@Test
public void testRenameReplace() throws Exception {
enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
final VirtualFile a = createFileInCommand("a.txt", "old");
final VirtualFile aNew = createFileInCommand("aNew.txt", "new");
checkin();
renameFileInCommand(a, "aOld.txt");
renameFileInCommand(aNew, "a.txt");
final ProcessOutput result = runSvn("status");
verifySorted(result, "A + aOld.txt", "D aNew.txt", "R + a.txt");
}
Aggregations