Package org.eclipse.cdt.core
Class CommandLauncher
java.lang.Object
org.eclipse.cdt.core.CommandLauncher
- All Implemented Interfaces:
ICommandLauncher
- Restriction:
- This class is not intended to be subclassed by clients.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new launcher Fills in stderr and stdout output to the given streams. -
Method Summary
Modifier and TypeMethodDescriptionprotected String[]constructCommandArray(String command, String[] commandArgs) Constructs a command array that will be passed to the processexecute(org.eclipse.core.runtime.IPath commandPath, String[] args, String[] env, org.eclipse.core.runtime.IPath workingDirectory, org.eclipse.core.runtime.IProgressMonitor monitor) Execute a commandString[]Returns an array of the command line arguments that were last used to execute a command.Returns the constructed command line of the last command executed.protected StringgetCommandLine(String[] commandArgs) Returns the set of environment variables in the context of which this launcher will execute commands.Returns a human readable error message corresponding to the last error encountered during command execution.org.eclipse.core.resources.IProjectGets the project this launcher is associated with.protected voidvoidsetErrorMessage(String error) Sets the human readable error message corresponding to the last error encountered during command execution.voidsetProject(org.eclipse.core.resources.IProject project) Sets the project that this launcher is associated with, ornullif there is no such project.voidshowCommand(boolean show) Sets if the command should be printed out first before executing.intwaitAndRead(OutputStream out, OutputStream err) Deprecated.intwaitAndRead(OutputStream output, OutputStream err, org.eclipse.core.runtime.IProgressMonitor monitor) Reads output form the process to the streams.
-
Field Details
-
COMMAND_CANCELED
public static final int COMMAND_CANCELED- See Also:
-
ILLEGAL_COMMAND
public static final int ILLEGAL_COMMAND- See Also:
-
OK
public static final int OK- See Also:
-
fProcess
-
fShowCommand
protected boolean fShowCommand -
fCommandArgs
-
fErrorMessage
-
DELAY
protected static final long DELAYThe number of milliseconds to pause between polling.- See Also:
-
-
Constructor Details
-
CommandLauncher
public CommandLauncher()Creates a new launcher Fills in stderr and stdout output to the given streams. Streams can be set tonull, if output not required
-
-
Method Details
-
showCommand
public void showCommand(boolean show) Description copied from interface:ICommandLauncherSets if the command should be printed out first before executing.- Specified by:
showCommandin interfaceICommandLauncher
-
getErrorMessage
Description copied from interface:ICommandLauncherReturns a human readable error message corresponding to the last error encountered during command execution.- Specified by:
getErrorMessagein interfaceICommandLauncher- Returns:
- A String corresponding to the error, or
nullif there has been no error. The message could be multi-line, however it is NOT guaranteed that it ends with end of line.
-
setErrorMessage
Description copied from interface:ICommandLauncherSets 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:
setErrorMessagein interfaceICommandLauncher- Parameters:
error- A String corresponding to the error message, ornullif the error state is intended to be cleared.
-
getCommandArgs
Description copied from interface:ICommandLauncherReturns an array of the command line arguments that were last used to execute a command.- Specified by:
getCommandArgsin interfaceICommandLauncher- Returns:
- an array of type String[] corresponding to the arguments. The array can be empty, but should not be null.
-
getEnvironment
Description copied from interface:ICommandLauncherReturns the set of environment variables in the context of which this launcher will execute commands.- Specified by:
getEnvironmentin interfaceICommandLauncher- Returns:
- Properties
-
getCommandLine
Description copied from interface:ICommandLauncherReturns the constructed command line of the last command executed.- Specified by:
getCommandLinein interfaceICommandLauncher- Returns:
- String
-
constructCommandArray
Constructs a command array that will be passed to the process -
execute
public Process execute(org.eclipse.core.runtime.IPath commandPath, String[] args, String[] env, org.eclipse.core.runtime.IPath workingDirectory, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException Description copied from interface:ICommandLauncherExecute a command- Specified by:
executein interfaceICommandLauncher- Parameters:
env- The list of environment variables in variable=value format.- Throws:
org.eclipse.core.runtime.CoreException- if there is an error executing the command.- Since:
- 5.1
- See Also:
-
waitAndRead
Deprecated.- Specified by:
waitAndReadin interfaceICommandLauncher
-
waitAndRead
public int waitAndRead(OutputStream output, OutputStream err, org.eclipse.core.runtime.IProgressMonitor monitor) Description copied from interface:ICommandLauncherReads 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:
waitAndReadin interfaceICommandLauncher- Parameters:
output- the output stream that the command's stdout should be directed to. Typically connected toIConsole.getOutputStream()err- the output stream that the command's stderr should be directed to. Typically connected toIConsole.getErrorStream()
-
printCommandLine
-
getCommandLine
-
getProject
public org.eclipse.core.resources.IProject getProject()Description copied from interface:ICommandLauncherGets the project this launcher is associated with.- Specified by:
getProjectin interfaceICommandLauncher- Returns:
- IProject, or
nullif there is no such project. - Since:
- 5.1
- See Also:
-
setProject
public void setProject(org.eclipse.core.resources.IProject project) Description copied from interface:ICommandLauncherSets the project that this launcher is associated with, ornullif there is no such project.- Specified by:
setProjectin interfaceICommandLauncher- Parameters:
project-- Since:
- 5.1
- See Also:
-