public void setOutputs(ExecSpec execSpec) { execSpec.setStandardOutput(teeStdOut); execSpec.setErrorOutput(teeErrOut); }
public void setOutputs(ExecSpec execSpec) { execSpec.setStandardOutput(teeStdOut); execSpec.setErrorOutput(teeErrOut); }
@Override public void accept(File file) { if (distutilsCfg != null) { final Path path = file.toPath(); try { Files.write(path.resolve( Paths.get("virtualenv_embedded", "distutils.cfg")), distutilsCfg.getBytes(), StandardOpenOption.APPEND); } catch (IOException e) { throw new UncheckedIOException(e); } final ByteArrayOutputStream stream = new ByteArrayOutputStream(); exec.exec(execSpec -> { execSpec.commandLine(pythonDetails.getSystemPythonInterpreter(), path.resolve(Paths.get("bin", "rebuild-script.py")).toFile()); execSpec.setStandardOutput(stream); execSpec.setErrorOutput(stream); }); log.info("Customized distutils.cfg"); } } }
@Override public void accept(File file) { if (distutilsCfg != null) { final Path path = file.toPath(); try { Files.write(path.resolve( Paths.get("virtualenv_embedded", "distutils.cfg")), distutilsCfg.getBytes(), StandardOpenOption.APPEND); } catch (IOException e) { throw new UncheckedIOException(e); } final ByteArrayOutputStream stream = new ByteArrayOutputStream(); exec.exec(execSpec -> { execSpec.commandLine(pythonDetails.getSystemPythonInterpreter(), path.resolve(Paths.get("bin", "rebuild-script.py")).toFile()); execSpec.setStandardOutput(stream); execSpec.setErrorOutput(stream); }); log.info("Customized distutils.cfg"); } } }
public static PythonVersion parsePythonVersion(final Project project, final File pythonInterpreter) { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); ExecResult execResult = project.exec(execSpec -> { execSpec.setExecutable(pythonInterpreter.getAbsolutePath()); execSpec.setArgs(Collections.singletonList("--version")); execSpec.setStandardOutput(outputStream); execSpec.setErrorOutput(outputStream); execSpec.setIgnoreExitValue(true); }); String output = outputStream.toString(); if (execResult.getExitValue() != 0) { throw new GradleException(output); } String versionString = output.trim().split(" ")[1]; return new PythonVersion(versionString); } }
public static PythonVersion parsePythonVersion(final Project project, final File pythonInterpreter) { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); ExecResult execResult = project.exec(execSpec -> { execSpec.setExecutable(pythonInterpreter.getAbsolutePath()); execSpec.setArgs(Collections.singletonList("--version")); execSpec.setStandardOutput(outputStream); execSpec.setErrorOutput(outputStream); execSpec.setIgnoreExitValue(true); }); String output = outputStream.toString(); if (execResult.getExitValue() != 0) { throw new GradleException(output); } String versionString = output.trim().split(" ")[1]; return new PythonVersion(versionString); } }
@Override public void execute(ExecSpec execSpec) { /* * Gradle doesn't work correctly when there are empty args. */ List<String> args = processInfo.getArgs().stream() .map(a -> a.isEmpty()? "\"\"" : a) .collect(Collectors.toList()); execSpec.setExecutable(processInfo.getExecutable()); execSpec.args(args); execSpec.environment(processInfo.getEnvironment()); execSpec.setStandardOutput(processOutput.getStandardOutput()); execSpec.setErrorOutput(processOutput.getErrorOutput()); // we want the caller to be able to do its own thing. execSpec.setIgnoreExitValue(true); } }
@Override public void execute(ExecSpec execSpec) { execSpec.commandLine(pythonExtension.getDetails().getVirtualEnvInterpreter()); execSpec.args(pythonExtension.getDetails().getVirtualEnvironment().getPex()); System.out.println(outputFile.getAbsolutePath()); execSpec.args(Arrays.asList("--no-pypi", "--cache-dir", pexCache.getAbsolutePath(), "--output-file", outputFile.getAbsolutePath(), "--repo", wheelCache.getAbsolutePath(), "--python-shebang", pexShebang.getAbsolutePath())); if (entryPoint != null) { execSpec.args(Arrays.asList("--entry-point", entryPoint)); } execSpec.args(pexOptions); execSpec.args(pexRequirements(dependencies)); execSpec.setStandardOutput(outputStream); execSpec.setErrorOutput(outputStream); execSpec.setIgnoreExitValue(true); }
ExecResult execCommand(Map<String, String> mergedEnv, List<String> commandLine, OutputStream stream) { return externalExec.exec(execSpec -> { execSpec.environment(mergedEnv); execSpec.commandLine(commandLine); execSpec.setStandardOutput(stream); execSpec.setErrorOutput(stream); execSpec.setIgnoreExitValue(true); }); }
@Override public void execute(ExecSpec execSpec) { execSpec.commandLine(pythonExtension.getDetails().getVirtualEnvInterpreter()); execSpec.args(pythonExtension.getDetails().getVirtualEnvironment().getPex()); System.out.println(outputFile.getAbsolutePath()); execSpec.args(Arrays.asList("--no-pypi", "--cache-dir", pexCache.getAbsolutePath(), "--output-file", outputFile.getAbsolutePath(), "--repo", wheelCache.getAbsolutePath(), "--python-shebang", pexShebang.getAbsolutePath())); if (entryPoint != null) { execSpec.args(Arrays.asList("--entry-point", entryPoint)); } execSpec.args(pexOptions); execSpec.args(pexRequirements(dependencies)); execSpec.setStandardOutput(outputStream); execSpec.setErrorOutput(outputStream); execSpec.setIgnoreExitValue(true); }
ExecResult execCommand(Map<String, String> mergedEnv, List<String> commandLine, OutputStream stream) { return externalExec.exec(execSpec -> { execSpec.environment(mergedEnv); execSpec.commandLine(commandLine); execSpec.setStandardOutput(stream); execSpec.setErrorOutput(stream); execSpec.setIgnoreExitValue(true); }); }
@Override public void execute(ExecSpec execSpec) { if (workingDirectory != null) { execSpec.setWorkingDir(workingDirectory); } execSpec.setCommandLine((Object[])Commandline.translateCommandline(command)); execSpec.setIgnoreExitValue(ignoreExitValue); if (logStandardOutput) { execSpec.setStandardOutput(standardOutputStream); } execSpec.setErrorOutput(errorOutputStream); } });
execSpec.setErrorOutput(err); }); } catch (Throwable t) {
@Override public void execute(final ExecSpec it) { it.setExecutable(info.getShellExecutable()); if (isWindows()) { it.environment("MSYSTEM", mSystem); it.environment("CHERE_INVOKING", "1"); } it.args(getAllArgs()); if (!workingDir.isDirectory()) { workingDir.mkdirs(); } it.setWorkingDir(workingDir); it.setStandardInput(standardInput); it.setStandardOutput(standardOutput); it.setErrorOutput(errorOutput); } });
@Override public void execute(ExecSpec execSpec) { execSpec.setCommandLine(_getCommandLine()); execSpec.setEnvironment( _getEnvironment(execSpec.getEnvironment())); execSpec.setErrorOutput( new TeeOutputStream(byteArrayOutputStream, System.out)); execSpec.setStandardOutput( new TeeOutputStream(byteArrayOutputStream, System.out)); execSpec.setWorkingDir(getWorkingDir()); }
pythonDetails.getVirtualEnv() ); execSpec.setErrorOutput(outputStream); execSpec.setStandardOutput(outputStream); execSpec.setIgnoreExitValue(true);
@Override public void execute(ExecSpec execSpec) { execSpec.setCommandLine(_getCommandLine()); execSpec.setEnvironment( _getEnvironment(execSpec.getEnvironment())); execSpec.setErrorOutput( new TeeOutputStream(byteArrayOutputStream, System.out)); execSpec.setStandardOutput( new TeeOutputStream(byteArrayOutputStream, System.out)); execSpec.setWorkingDir(getWorkingDir()); }
packageInfo.getPackageFile().getAbsoluteFile().getAbsolutePath()); exec.setStandardOutput(stream); exec.setErrorOutput(stream); exec.setIgnoreExitValue(true); });
@Override public void execute(ExecSpec spec) { spec.setIgnoreExitValue(true); spec.commandLine(execCommand.getCommandLine()); spec.setStandardOutput(new ExternalProcessStream(execCommand.getLoggingPrefix(), System.out)); spec.setErrorOutput(new ExternalProcessStream(execCommand.getLoggingPrefix(), System.err)); execCommand.getSetupAction().execute(spec); LOG.lifecycle(" " + execCommand.getDescription() + ":\n " + StringUtil.join(execCommand.getCommandLine(), " ")); } });
@Override public void execute(ExecSpec spec) { spec.setIgnoreExitValue(true); spec.commandLine(execCommand.getCommandLine()); spec.setStandardOutput(new ExternalProcessStream(execCommand.getLoggingPrefix(), System.out)); spec.setErrorOutput(new ExternalProcessStream(execCommand.getLoggingPrefix(), System.err)); execCommand.getSetupAction().execute(spec); LOG.lifecycle(" " + execCommand.getDescription() + ":\n " + StringUtil.join(execCommand.getCommandLine(), " ")); } });