Package hudson.Launcher

Examples of hudson.Launcher.ProcStarter


                DataInputStream in = new DataInputStream(fs.read(jdkBundle));
                in.readFully(header);
                in.close();
            }

            ProcStarter starter;
            if (header[0]==0x1F && header[1]==(byte)0x8B) {// gzip
                starter = launcher.launch().cmds("tar", "xvzf", jdkBundle);
            } else {
                fs.chmod(jdkBundle,0755);
                starter = launcher.launch().cmds(jdkBundle, "-noregister");
            }

            int exit = starter
                    .stdin(new ByteArrayInputStream("yes".getBytes())).stdout(out)
                    .pwd(new FilePath(launcher.getChannel(), expectedLocation)).join();
            if (exit != 0)
                throw new AbortException(Messages.JDKInstaller_FailedToInstallJDK(exit));
View Full Code Here


            }

            ArgumentListBuilder arguments = new ArgumentListBuilder(fruitstrap.getRemote());
            arguments.add("--id", deviceId, "--bundle", appDir.getName());

            ProcStarter proc = new LocalLauncher(listener).launch()
                    .cmds(arguments)
                    .stdout(listener)
                    .pwd(appDir.getParent());
            int exit = proc.join();
            if (exit!=0)
                throw new IOException("Deployment of "+bundle+" failed: "+exit);

            return null;
        } catch (InterruptedException e) {
View Full Code Here

        String list = StringUtils.join(components, ',');
        log(logger, Messages.INSTALLING_SDK_COMPONENTS(list));
        String all = sdk.getSdkToolsVersion() < 17 ? "-o" : "-a";
        String upgradeArgs = String.format("update sdk -u %s %s -t %s", all, proxySettings, list);
        ArgumentListBuilder cmd = Utils.getToolCommand(sdk, launcher.isUnix(), Tool.ANDROID, upgradeArgs);
        ProcStarter procStarter = launcher.launch().stderr(logger).readStdout().writeStdin().cmds(cmd);
        if (sdk.hasKnownHome()) {
            EnvVars env = new EnvVars();
            env.put("ANDROID_SDK_HOME", sdk.getSdkHome());
            procStarter = procStarter.envs(env);
        }

        // Run the command and accept any licence requests during installation
        Proc proc = procStarter.start();
        BufferedReader r = new BufferedReader(new InputStreamReader(proc.getStdout()));
        String line;
        while (proc.isAlive() && (line = r.readLine()) != null) {
            logger.println(line);
            if (line.toLowerCase(Locale.ENGLISH).startsWith("license id: ")) {
View Full Code Here

    public static void runAndroidTool(Launcher launcher, EnvVars env, OutputStream stdout, OutputStream stderr,
            AndroidSdk androidSdk, Tool tool, String args, FilePath workingDirectory)
                throws IOException, InterruptedException {

        ArgumentListBuilder cmd = Utils.getToolCommand(androidSdk, launcher.isUnix(), tool, args);
        ProcStarter procStarter = launcher.launch().stdout(stdout).stderr(stderr).cmds(cmd);
        if (androidSdk.hasKnownHome()) {
            // Copy the old one, so we don't mutate the argument.
            env = new EnvVars((env == null ? new EnvVars() : env));
            env.put("ANDROID_SDK_HOME", androidSdk.getSdkHome());
        }

        if (env != null) {
            procStarter = procStarter.envs(env);
        }

        if (workingDirectory != null) {
            procStarter.pwd(workingDirectory);
        }
        procStarter.join();
    }
View Full Code Here

        final ByteArrayStream stdout = new ByteArrayStream();
        final ByteArrayStream stderr = new ByteArrayStream();
        try {
            final OutputStream stdoutStream = stdout.getOutput();
            final OutputStream stderrStream = stderr.getOutput();
            final ProcStarter starter = createProcess(launcher, machineReadableCommand, masksOrNull,
                    environmentVariables, directoryToRunCommandFrom, stdoutStream, stderrStream);
            logCommandExecution(machineReadableCommand, directoryToRunCommandFrom, loggerToLogFailuresTo,
                    listenerToLogFailuresTo);
            try {
                final int commandExitCode = runCommandToCompletion(starter, synchronizationLockObjectOrNull);
View Full Code Here

            final boolean[] masksOrNull, //
            final Map<String, String> environmentVariables, //
            final FilePath directoryToRunCommandFrom, //
            final OutputStream stdoutStream, //
            final OutputStream stderrStream) {
        ProcStarter starter = launcher.launch().cmds(machineReadableCommand);
        if (masksOrNull != null) {
            starter = starter.masks(masksOrNull);
        }
        starter = starter.envs(environmentVariables);
        starter = starter.stdout(stdoutStream).stderr(stderrStream);
        starter = starter.pwd(directoryToRunCommandFrom);
        return starter;
    }
View Full Code Here

TOP

Related Classes of hudson.Launcher.ProcStarter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.