/** * Primarily invoked from {@link ProcStarter#start()} to start a process with a specific launcher. */ public abstract Proc launch(@Nonnull ProcStarter starter) throws IOException;
/** * @param env * Environment variable overrides. * @param in * null if there's no input. * @param workDir * null if the working directory could be anything. * @param out * stdout and stderr of the process will be sent to this stream. * the stream won't be closed. * * @deprecated as of 1.311 * Use {@link #launch()} and its associated builder pattern */ @Deprecated public Proc launch(String[] cmd, String[] env, InputStream in, OutputStream out, FilePath workDir) throws IOException { return launch(launch().cmds(cmd).envs(env).stdin(in).stdout(out).pwd(workDir)); }
envVars.put(e.getKey(),e.getValue()); r = join(launcher.launch().cmds(buildCommandLine(script)).envs(envVars).stdout(listener).pwd(ws).start());
/** * Copies a {@link ProcStarter}. */ public ProcStarter copy() { return new ProcStarter().cmds(commands).pwd(pwd).masks(masks).stdin(stdin).stdout(stdout).stderr(stderr).envs(envs); } }
/** * Build the process starter. */ public Launcher.ProcStarter build(final Launcher.ProcStarter starter) throws Exception { assert starter != null; return starter .cmds(buildArguments()) .envs(buildEnv()) .pwd(ensureNotNull(workingDir)) .stdout(ensureNotNull(standardOutput)); }
/** * Primarily invoked from {@link ProcStarter#start()} to start a process with a specific launcher. */ public abstract Proc launch(@Nonnull ProcStarter starter) throws IOException;
/** * Copies a {@link ProcStarter}. */ public ProcStarter copy() { return new ProcStarter().cmds(commands).pwd(pwd).masks(masks).stdin(stdin).stdout(stdout).stderr(stderr).envs(envs); } }
/** * Sets the environment variable overrides. * * <p> * In adition to what the current process * is inherited (if this is going to be launched from a slave agent, that * becomes the "current" process), these variables will be also set. */ public ProcStarter envs(Map<String, String> overrides) { return envs(Util.mapToEnv(overrides)); }
/** * Copies a {@link ProcStarter}. */ public ProcStarter copy() { return new ProcStarter().cmds(commands).pwd(pwd).masks(masks).stdin(stdin).stdout(stdout).stderr(stderr).envs(envs); } }
private Launcher.ProcStarter launchDockerCLI(Launcher launcher, ArgumentListBuilder args) { prependArgs(args); return launcher.launch() .envs(dockerHost.getEnvironment()) .cmds(args) .quiet(!verbose); }
public boolean pullImage(String image) throws IOException, InterruptedException { ArgumentListBuilder args = dockerCommand() .add("pull", image); OutputStream out = verbose ? listener.getLogger() : new ByteArrayOutputStream(); OutputStream err = verbose ? listener.getLogger() : new ByteArrayOutputStream(); int status = launcher.launch() .envs(getEnvVars()) .cmds(args) .stdout(out).stderr(err).join(); return status == 0; }
public boolean hasImage(String image) throws IOException, InterruptedException { ArgumentListBuilder args = dockerCommand() .add("inspect", image); OutputStream out = verbose ? listener.getLogger() : new ByteArrayOutputStream(); OutputStream err = verbose ? listener.getLogger() : new ByteArrayOutputStream(); int status = launcher.launch() .envs(getEnvVars()) .cmds(args) .stdout(out).stderr(err).quiet(!verbose).join(); return status == 0; }
/** * Primarily invoked from {@link ProcStarter#start()} to start a process * with a specific launcher. */ public abstract Proc launch(ProcStarter starter) throws IOException;
public int runCmd(String[] commands, FilePath workspace, OutputStream logger, Launcher launcher, EnvVars envVars) throws InterruptedException, IOException { try { return launcher.launch().cmds(commands).envs(envVars).stdout(logger).stderr(logger).pwd(workspace).start().join(); } catch (IOException ex) { logger.write(ex.getMessage().getBytes()); if (printDebugOutput) { logger.write(Throwables.getStackTraceAsString(ex).getBytes()); } return 1; } }
/** * Sets the environment variable overrides. * * <p> * In adition to what the current process * is inherited (if this is going to be launched from a slave agent, that * becomes the "current" process), these variables will be also set. */ public ProcStarter envs(Map<String, String> overrides) { return envs(Util.mapToEnv(overrides)); }
/** * Copies a {@link ProcStarter}. */ @Nonnull public ProcStarter copy() { ProcStarter rhs = new ProcStarter().cmds(commands).pwd(pwd).masks(masks).stdin(stdin).stdout(stdout).stderr(stderr).envs(envs).quiet(quiet); rhs.reverseStdin = this.reverseStdin; rhs.reverseStderr = this.reverseStderr; rhs.reverseStdout = this.reverseStdout; return rhs; } }
/** * Sets the environment variable overrides. * * <p> * In adition to what the current process * is inherited (if this is going to be launched from a slave agent, that * becomes the "current" process), these variables will be also set. */ public ProcStarter envs(Map<String, String> overrides) { return envs(Util.mapToEnv(overrides)); }
int r = launcher.launch().cmds(args).envs(env).stdout(mca).pwd(build.getModuleRoot()).join(); if (0 != r) { return false;
public RemoteProcess call() throws IOException { final Channel channel = getOpenChannelOrFail(); Launcher.ProcStarter ps = new LocalLauncher(listener).launch(); ps.cmds(cmd).masks(masks).envs(env).stdin(in).stderr(err).quiet(quiet); if (stdoutListener != null) { ps.stdout(stdoutListener.getLogger());
/** * Copies a {@link ProcStarter}. */ @Nonnull public ProcStarter copy() { ProcStarter rhs = new ProcStarter().cmds(commands).pwd(pwd).masks(masks).stdin(stdin).stdout(stdout).stderr(stderr).envs(envs).quiet(quiet); rhs.stdoutListener = stdoutListener; rhs.reverseStdin = this.reverseStdin; rhs.reverseStderr = this.reverseStderr; rhs.reverseStdout = this.reverseStdout; return rhs; } }