Class CommandLauncher

    • Constructor Detail

      • CommandLauncher

        public CommandLauncher()
        Creates a new launcher Fills in stderr and stdout output to the given streams. Streams can be set to null, if output not required
    • Method Detail

      • showCommand

        public void showCommand​(boolean show)
        Description copied from interface: ICommandLauncher
        Sets if the command should be printed out first before executing.
        Specified by:
        showCommand in interface ICommandLauncher
      • getErrorMessage

        public String getErrorMessage()
        Description copied from interface: ICommandLauncher
        Returns a human readable error message corresponding to the last error encountered during command execution.
        Specified by:
        getErrorMessage in interface ICommandLauncher
        Returns:
        A String corresponding to the error, or null if there has been no error. The message could be multi-line, however it is NOT guaranteed that it ends with end of line.
      • setErrorMessage

        public void setErrorMessage​(String error)
        Description copied from interface: ICommandLauncher
        Sets the human readable error message corresponding to the last error encountered during command execution. A subsequent call to getErrorMessage() will return this string.
        Specified by:
        setErrorMessage in interface ICommandLauncher
        Parameters:
        error - A String corresponding to the error message, or null if the error state is intended to be cleared.
      • getCommandArgs

        public String[] getCommandArgs()
        Description copied from interface: ICommandLauncher
        Returns an array of the command line arguments that were last used to execute a command.
        Specified by:
        getCommandArgs in interface ICommandLauncher
        Returns:
        an array of type String[] corresponding to the arguments. The array can be empty, but should not be null.
      • getEnvironment

        public Properties getEnvironment()
        Description copied from interface: ICommandLauncher
        Returns the set of environment variables in the context of which this launcher will execute commands.
        Specified by:
        getEnvironment in interface ICommandLauncher
        Returns:
        Properties
      • constructCommandArray

        protected String[] constructCommandArray​(String command,
                                                 String[] commandArgs)
        Constructs a command array that will be passed to the process
      • execute

        @Deprecated
        public Process execute​(org.eclipse.core.runtime.IPath commandPath,
                               String[] args,
                               String[] env,
                               org.eclipse.core.runtime.IPath changeToDirectory)
        Deprecated.
        Since:
        5.1
      • waitAndRead

        public int waitAndRead​(OutputStream output,
                               OutputStream err,
                               org.eclipse.core.runtime.IProgressMonitor monitor)
        Description copied from interface: ICommandLauncher
        Reads output form the process to the streams. A progress monitor is polled to test if the cancel button has been pressed. Destroys the process if the monitor becomes canceled override to implement a different way to read the process inputs
        Specified by:
        waitAndRead in interface ICommandLauncher
      • printCommandLine

        protected void printCommandLine​(OutputStream os)
      • getCommandLine

        protected String getCommandLine​(String[] commandArgs)