Package hudson
Class Launcher.DecoratedLauncher
java.lang.Object
hudson.Launcher
hudson.Launcher.DecoratedLauncher
- Enclosing class:
- 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
-
Method Summary
Modifier and TypeMethodDescriptionhudson.remoting.VirtualChannel
Gets the channel that can be used to run a program remotely.getInner()
Gets nested launcher.Gets theTaskListener
that this launcher uses to report the commands that it's executing.boolean
isUnix()
Returns true if thisLauncher
is going to launch on Unix.void
CallsProcessTree.killAll(Map)
to kill processes.launch
(Launcher.ProcStarter starter) Primarily invoked fromLauncher.ProcStarter.start()
to start a process with a specific launcher.launch
(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.launch
(String[] cmd, String[] env, InputStream in, OutputStream out, FilePath workDir) hudson.remoting.Channel
launchChannel
(String[] cmd, OutputStream out, FilePath workDir, Map<String, String> envVars) Launches a specified process and connects its input/output to aChannel
, then return it.toString()
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 Details
-
DecoratedLauncher
-
-
Method Details
-
launch
Description copied from class:Launcher
Primarily invoked fromLauncher.ProcStarter.start()
to start a process with a specific launcher.- Specified by:
launch
in classLauncher
- Throws:
IOException
-
launchChannel
public hudson.remoting.Channel launchChannel(String[] cmd, OutputStream out, FilePath workDir, Map<String, String> envVars) throws IOException, InterruptedExceptionDescription copied from class:Launcher
Launches 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:
launchChannel
in classLauncher
- Parameters:
cmd
- The commands.out
- Where the stderr from the launched process will be sent.workDir
- The working directory of the new process, ornull
to 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:
IOException
InterruptedException
-
kill
Description copied from class:Launcher
CallsProcessTree.killAll(Map)
to kill processes.- Specified by:
kill
in classLauncher
- Throws:
IOException
InterruptedException
-
isUnix
public boolean isUnix()Description copied from class:Launcher
Returns true if thisLauncher
is 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:Launcher
Launch 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:
launch
in 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
Description copied from class:Launcher
If thisLauncher
is encapsulating an execution on a specificComputer
, return it.Because of the way internal Hudson abstractions are set up (that is,
Launcher
only needs aVirtualChannel
to do its job and isn't really required that the channel comes from an existingComputer
), this method may not always the rightComputer
instance.- Overrides:
getComputer
in classLauncher
- Returns:
null
if this launcher is not created from aComputer
object.
-
getListener
Description copied from class:Launcher
Gets theTaskListener
that this launcher uses to report the commands that it's executing.- Overrides:
getListener
in classLauncher
- Returns:
- Task listener
-
toString
-
getChannel
public hudson.remoting.VirtualChannel getChannel()Description copied from class:Launcher
Gets the channel that can be used to run a program remotely.- Overrides:
getChannel
in classLauncher
- Returns:
null
if 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:
launch
in classLauncher
env
- 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
Gets nested launcher.- Returns:
- Inner launcher
-