/** * Starts the new process as configured. */ public Proc start() throws IOException { return launch(this); }
@Override public Proc launch(ProcStarter starter) throws IOException { return inner.launch(starter); }
@Override public Proc launch(String[] cmd, boolean[] mask, String[] env, InputStream in, OutputStream out, FilePath workDir) throws IOException { return inner.launch(cmd, mask, env, in, out, workDir); }
@Override public Proc launch(String[] cmd, String[] env, InputStream in, OutputStream out, FilePath workDir) throws IOException { return inner.launch(cmd, env, in, out, workDir); }
/** * @deprecated as of 1.311 * Use {@link #launch()} and its associated builder pattern */ @Deprecated public final Proc launch(String[] cmd, String[] env, OutputStream out, FilePath workDir) throws IOException { return launch(cmd, env, null, out, workDir); }
/** * @deprecated as of 1.311 * Use {@link #launch()} and its associated builder pattern */ @Deprecated public final Proc launch(String[] cmd, String[] env, InputStream in, OutputStream out) throws IOException { return launch(cmd, env, in, out, null); }
/** * Launch a command with optional censoring of arguments from the listener (Note: <strong>The censored portions will * remain visible through /proc, pargs, process explorer, etc. i.e. people logged in on the same machine</strong> * This version of the launch command just ensures that it is not visible from a build log which is exposed via the * web) * * @param cmd The command and all it's arguments. * @param mask Which of the command and arguments should be masked from the listener * @param env Environment variable overrides. * @param in null if there's no input. * @param out stdout and stderr of the process will be sent to this stream. the stream won't be closed. * @return The process of the command. * @throws IOException When there are IO problems. * * @deprecated as of 1.311 * Use {@link #launch()} and its associated builder pattern */ @Deprecated public final Proc launch(String[] cmd, boolean[] mask, String[] env, InputStream in, OutputStream out) throws IOException { return launch(cmd, mask, env, in, out, null); }
@Override public Proc launch(ProcStarter starter) throws IOException { starter.commands.addAll(0,Arrays.asList(prefix)); boolean[] masks = starter.masks; if (masks != null) { starter.masks = prefix(masks); } return outer.launch(starter); }
/** * @deprecated as of 1.311 * Use {@link #launch()} and its associated builder pattern */ @Deprecated public final Proc launch(String[] cmd, Map<String, String> env, OutputStream out, FilePath workDir) throws IOException { return launch(cmd, Util.mapToEnv(env), out, workDir); }
/** * @deprecated as of 1.311 * Use {@link #launch()} and its associated builder pattern */ @Deprecated public final Proc launch(String[] cmd, Map<String, String> env, InputStream in, OutputStream out) throws IOException { return launch(cmd, Util.mapToEnv(env), in, out); }
/** * @deprecated as of 1.311 * Use {@link #launch()} and its associated builder pattern */ @Deprecated public final Proc launch(String cmd,String[] env,OutputStream out, FilePath workDir) throws IOException { return launch(Util.tokenize(cmd),env,out,workDir); }
/** * @deprecated as of 1.311 * Use {@link #launch()} and its associated builder pattern */ @Deprecated public final Proc launch(String cmd, Map<String,String> env, OutputStream out, FilePath workDir) throws IOException { return launch(cmd,Util.mapToEnv(env),out,workDir); }
/** * Launch a command with optional censoring of arguments from the listener (Note: <strong>The censored portions will * remain visible through /proc, pargs, process explorer, etc. i.e. people logged in on the same machine</strong> * This version of the launch command just ensures that it is not visible from a build log which is exposed via the * web) * * @param cmd The command and all it's arguments. * @param mask Which of the command and arguments should be masked from the listener * @param env Environment variable overrides. * @param in null if there's no input. * @param out stdout and stderr of the process will be sent to this stream. the stream won't be closed. * @return The process of the command. * @throws IOException When there are IO problems. * * @deprecated as of 1.311 * Use {@link #launch()} and its associated builder pattern */ @Deprecated public final Proc launch(String[] cmd, boolean[] mask, Map<String, String> env, InputStream in, OutputStream out) throws IOException { return launch(cmd, mask, Util.mapToEnv(env), in, out); }
/** * Launch a command with optional censoring of arguments from the listener (Note: <strong>The censored portions will * remain visible through /proc, pargs, process explorer, etc. i.e. people logged in on the same machine</strong> * This version of the launch command just ensures that it is not visible from a build log which is exposed via the * web) * * @param cmd The command and all it's arguments. * @param mask Which of the command and arguments should be masked from the listener * @param env Environment variable overrides. * @param out stdout and stderr of the process will be sent to this stream. the stream won't be closed. * @param workDir null if the working directory could be anything. * @return The process of the command. * @throws IOException When there are IO problems. * * @deprecated as of 1.311 * Use {@link #launch()} and its associated builder pattern */ @Deprecated public final Proc launch(String[] cmd, boolean[] mask, Map<String, String> env, OutputStream out, FilePath workDir) throws IOException { return launch(cmd, mask, Util.mapToEnv(env), out, workDir); }
/** * 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)); }
/** * Fills a {@link ProcStarter} with all the parameters configured by this builder. */ public ProcStarter launch(Launcher launcher) { return launcher.launch().cmds(toFullArguments()).pwd(pwd); }
@Override public Proc launch(ProcStarter starter) throws IOException { EnvVars e = new EnvVars(env); if (starter.envs!=null) { for (String env : starter.envs) { e.addLine(env); } } starter.envs = Util.mapToEnv(e); return outer.launch(starter); }
/** * Checks if "java" is in PATH on the given node. * * <p> * If it's not, then the user must specify a configured JDK, * so this is often useful for form field validation. */ public static boolean isDefaultJDKValid(Node n) { try { TaskListener listener = new StreamTaskListener(new NullStream()); Launcher launcher = n.createLauncher(listener); return launcher.launch().cmds("java","-fullversion").stdout(listener).join()==0; } catch (IOException e) { return false; } catch (InterruptedException e) { return false; } }
@Override public FilePath performInstallation(ToolInstallation tool, Node node, TaskListener log) throws IOException, InterruptedException { FilePath dir = preferredLocation(tool, node); // TODO support Unix scripts with interpreter line (see Shell.buildCommandLine) FilePath script = dir.createTextTempFile("hudson", getCommandFileExtension(), command); try { String cmd[] = getCommandCall(script); int r = node.createLauncher(log).launch().cmds(cmd).stdout(log).pwd(dir).join(); if (r != 0) { throw new IOException("Command returned status " + r); } } finally { script.delete(); } return dir.child(getToolHome()); }