Package hudson
Class Launcher.DecoratedLauncher
- java.lang.Object
-
- hudson.Launcher
-
- hudson.Launcher.DecoratedLauncher
-
- Enclosing class:
- Launcher
public static class Launcher.DecoratedLauncher extends Launcher
A launcher which delegates to a provided inner launcher. Allows subclasses to only implement methods they want to override. Originally, this launcher has been implemented in Custom Tools Plugin.- Since:
- 1.568
- Author:
- rcampbell, Oleg Nenashev, Synopsys Inc.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class hudson.Launcher
Launcher.DecoratedLauncher, Launcher.DummyLauncher, Launcher.IOTriplet, Launcher.LocalLauncher, Launcher.ProcStarter, Launcher.RemoteLauncher, Launcher.RemoteProcess
-
-
Field Summary
-
Fields inherited from class hudson.Launcher
channel, envVarsFilterRuleWrapper, listener, showFullPath
-
-
Constructor Summary
Constructors Constructor Description DecoratedLauncher(Launcher inner)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description hudson.remoting.VirtualChannelgetChannel()Gets the channel that can be used to run a program remotely.ComputergetComputer()LaunchergetInner()Gets nested launcher.TaskListenergetListener()Gets theTaskListenerthat this launcher uses to report the commands that it's executing.booleanisUnix()Returns true if thisLauncheris going to launch on Unix.voidkill(Map<String,String> modelEnvVars)CallsProcessTree.killAll(Map)to kill processes.Proclaunch(Launcher.ProcStarter starter)Primarily invoked fromLauncher.ProcStarter.start()to start a process with a specific launcher.Proclaunch(String[] cmd, boolean[] mask, String[] env, InputStream in, OutputStream out, FilePath workDir)Launch a command with optional censoring of arguments from the listener (Note: The censored portions will remain visible through /proc, pargs, process explorer, etc.Proclaunch(String[] cmd, String[] env, InputStream in, OutputStream out, FilePath workDir)hudson.remoting.ChannellaunchChannel(String[] cmd, OutputStream out, FilePath workDir, Map<String,String> envVars)Launches a specified process and connects its input/output to aChannel, then return it.StringtoString()-
Methods inherited from class hudson.Launcher
decorateByEnv, decorateByPrefix, decorateFor, launch, launch, launch, launch, launch, launch, launch, launch, launch, launch, launch, maskedPrintCommandLine, maskedPrintCommandLine, prepareFilterRules, printCommandLine, setEnvVarsFilterRuleWrapper
-
-
-
-
Constructor Detail
-
DecoratedLauncher
public DecoratedLauncher(@NonNull Launcher inner)
-
-
Method Detail
-
launch
public Proc launch(Launcher.ProcStarter starter) throws IOException
Description copied from class:LauncherPrimarily invoked fromLauncher.ProcStarter.start()to start a process with a specific launcher.- Specified by:
launchin classLauncher- Throws:
IOException
-
launchChannel
public hudson.remoting.Channel launchChannel(String[] cmd, OutputStream out, FilePath workDir, Map<String,String> envVars) throws IOException, InterruptedException
Description copied from class:LauncherLaunches a specified process and connects its input/output to aChannel, then return it.When the returned channel is terminated, the process will be killed.
- Specified by:
launchChannelin classLauncher- Parameters:
cmd- The commands.out- Where the stderr from the launched process will be sent.workDir- The working directory of the new process, ornullto inherit from the current processenvVars- Environment variable overrides. In addition to what the current process is inherited (if this is going to be launched from an agent, that becomes the "current" process), these variables will be also set.- Throws:
IOExceptionInterruptedException
-
kill
public void kill(Map<String,String> modelEnvVars) throws IOException, InterruptedException
Description copied from class:LauncherCallsProcessTree.killAll(Map)to kill processes.- Specified by:
killin classLauncher- Throws:
IOExceptionInterruptedException
-
isUnix
public boolean isUnix()
Description copied from class:LauncherReturns true if thisLauncheris going to launch on Unix.
-
launch
public Proc launch(String[] cmd, boolean[] mask, String[] env, InputStream in, OutputStream out, FilePath workDir) throws IOException
Description copied from class:LauncherLaunch a command with optional censoring of arguments from the listener (Note: The censored portions will remain visible through /proc, pargs, process explorer, etc. i.e. people logged in on the same machine This version of the launch command just ensures that it is not visible from a build log which is exposed via the web)- Overrides:
launchin classLauncher- Parameters:
cmd- The command and all it's arguments.mask- Which of the command and arguments should be masked from the listenerenv- Environment variable overrides.in- null if there's no input.out- stdout and stderr of the process will be sent to this stream. the stream won't be closed.workDir- null if the working directory could be anything.- Returns:
- The process of the command.
- Throws:
IOException- When there are IO problems.
-
getComputer
public Computer getComputer()
Description copied from class:LauncherIf thisLauncheris encapsulating an execution on a specificComputer, return it.Because of the way internal Hudson abstractions are set up (that is,
Launcheronly needs aVirtualChannelto do its job and isn't really required that the channel comes from an existingComputer), this method may not always the rightComputerinstance.- Overrides:
getComputerin classLauncher- Returns:
nullif this launcher is not created from aComputerobject.
-
getListener
public TaskListener getListener()
Description copied from class:LauncherGets theTaskListenerthat this launcher uses to report the commands that it's executing.- Overrides:
getListenerin classLauncher- Returns:
- Task listener
-
getChannel
public hudson.remoting.VirtualChannel getChannel()
Description copied from class:LauncherGets the channel that can be used to run a program remotely.- Overrides:
getChannelin classLauncher- Returns:
nullif the target node is not configured to support this. this is a transitional measure. Note that a launcher for the built-in node is always non-null.
-
launch
public Proc launch(String[] cmd, String[] env, InputStream in, OutputStream out, FilePath workDir) throws IOException
- Overrides:
launchin classLauncherenv- Environment variable overrides.in- null if there's no input.out- stdout and stderr of the process will be sent to this stream. the stream won't be closed.workDir- null if the working directory could be anything.- Throws:
IOException
-
getInner
@NonNull public Launcher getInner()
Gets nested launcher.- Returns:
- Inner launcher
-
-