Package hudson

Class 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.
    • Constructor Detail

      • DecoratedLauncher

        public DecoratedLauncher​(@NonNull
                                 Launcher inner)
    • Method Detail

      • launchChannel

        public hudson.remoting.Channel launchChannel​(String[] cmd,
                                                     OutputStream out,
                                                     FilePath workDir,
                                                     Map<String,​String> envVars)
                                              throws IOException,
                                                     InterruptedException
        Description copied from class: Launcher
        Launches a specified process and connects its input/output to a Channel, then return it.

        When the returned channel is terminated, the process will be killed.

        Specified by:
        launchChannel in class Launcher
        Parameters:
        cmd - The commands.
        out - Where the stderr from the launched process will be sent.
        workDir - The working directory of the new process, or null to inherit from the current process
        envVars - 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
      • isUnix

        public boolean isUnix()
        Description copied from class: Launcher
        Returns true if this Launcher is going to launch on Unix.
        Overrides:
        isUnix in class Launcher
      • 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 class Launcher
        Parameters:
        cmd - The command and all it's arguments.
        mask - Which of the command and arguments should be masked from the listener
        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.
        Returns:
        The process of the command.
        Throws:
        IOException - When there are IO problems.
      • getComputer

        public Computer getComputer()
        Description copied from class: Launcher
        If this Launcher is encapsulating an execution on a specific Computer, return it.

        Because of the way internal Hudson abstractions are set up (that is, Launcher only needs a VirtualChannel to do its job and isn't really required that the channel comes from an existing Computer), this method may not always the right Computer instance.

        Overrides:
        getComputer in class Launcher
        Returns:
        null if this launcher is not created from a Computer object.
      • 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 class Launcher
        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 class Launcher
        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

        @NonNull
        public Launcher getInner()
        Gets nested launcher.
        Returns:
        Inner launcher