public class CommandLauncher extends Object implements ICommandLauncher
| Modifier and Type | Field and Description |
|---|---|
static int |
COMMAND_CANCELED |
protected static long |
DELAY
The number of milliseconds to pause between polling.
|
protected String[] |
fCommandArgs |
protected String |
fErrorMessage |
protected Process |
fProcess |
protected boolean |
fShowCommand |
static int |
ILLEGAL_COMMAND |
static int |
OK |
| Constructor and Description |
|---|
CommandLauncher()
Creates a new launcher Fills in stderr and stdout output to the given
streams.
|
| Modifier and Type | Method and Description |
|---|---|
protected String[] |
constructCommandArray(String command,
String[] commandArgs)
Constructs a command array that will be passed to the process
|
Process |
execute(org.eclipse.core.runtime.IPath commandPath,
String[] args,
String[] env,
org.eclipse.core.runtime.IPath changeToDirectory)
Deprecated.
|
Process |
execute(org.eclipse.core.runtime.IPath commandPath,
String[] args,
String[] env,
org.eclipse.core.runtime.IPath workingDirectory,
org.eclipse.core.runtime.IProgressMonitor monitor)
Execute a command
|
String[] |
getCommandArgs()
Returns an array of the command line arguments that were last used to execute a command.
|
String |
getCommandLine()
Returns the constructed command line of the last command executed.
|
protected String |
getCommandLine(String[] commandArgs) |
Properties |
getEnvironment()
Returns the set of environment variables in the context of which
this launcher will execute commands.
|
String |
getErrorMessage()
Returns a human readable error message corresponding to the last error encountered during command
execution.
|
org.eclipse.core.resources.IProject |
getProject()
Gets the project this launcher is associated with.
|
protected void |
printCommandLine(OutputStream os) |
void |
setErrorMessage(String error)
Sets the human readable error message corresponding to the last error encountered during command
execution.
|
void |
setProject(org.eclipse.core.resources.IProject project)
Sets the project that this launcher is associated with, or
null if there is no such
project. |
void |
showCommand(boolean show)
Sets if the command should be printed out first before executing.
|
int |
waitAndRead(OutputStream out,
OutputStream err)
Deprecated.
|
int |
waitAndRead(OutputStream output,
OutputStream err,
org.eclipse.core.runtime.IProgressMonitor monitor)
Reads output form the process to the streams.
|
public static final int COMMAND_CANCELED
public static final int ILLEGAL_COMMAND
public static final int OK
protected Process fProcess
protected boolean fShowCommand
protected String[] fCommandArgs
protected String fErrorMessage
protected static final long DELAY
public CommandLauncher()
null, if output not
requiredpublic void showCommand(boolean show)
ICommandLaunchershowCommand in interface ICommandLauncherpublic String getErrorMessage()
ICommandLaunchergetErrorMessage in interface ICommandLaunchernull if there has been no error.
The message could be multi-line, however it is NOT guaranteed that it ends with end of line.public void setErrorMessage(String error)
ICommandLaunchersetErrorMessage in interface ICommandLaunchererror - A String corresponding to the error message, or null if the error state is
intended to be cleared.public String[] getCommandArgs()
ICommandLaunchergetCommandArgs in interface ICommandLauncherpublic Properties getEnvironment()
ICommandLaunchergetEnvironment in interface ICommandLauncherpublic String getCommandLine()
ICommandLaunchergetCommandLine in interface ICommandLauncherprotected String[] constructCommandArray(String command, String[] commandArgs)
@Deprecated public Process execute(org.eclipse.core.runtime.IPath commandPath, String[] args, String[] env, org.eclipse.core.runtime.IPath changeToDirectory)
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
ICommandLauncherexecute in interface ICommandLauncherenv - The list of environment variables in variable=value format.org.eclipse.core.runtime.CoreException - if there is an error executing the command.ICommandLauncher.execute(IPath, String[], String[], IPath, IProgressMonitor)@Deprecated public int waitAndRead(OutputStream out, OutputStream err)
waitAndRead in interface ICommandLauncherpublic int waitAndRead(OutputStream output, OutputStream err, org.eclipse.core.runtime.IProgressMonitor monitor)
ICommandLauncherwaitAndRead in interface ICommandLauncherprotected void printCommandLine(OutputStream os)
public org.eclipse.core.resources.IProject getProject()
ICommandLaunchergetProject in interface ICommandLaunchernull if there is no such project.ICommandLauncher.getProject()public void setProject(org.eclipse.core.resources.IProject project)
ICommandLaunchernull if there is no such
project.setProject in interface ICommandLauncherICommandLauncher.setProject(org.eclipse.core.resources.IProject)Copyright (c) IBM Corp. and others 2004, 2020. All Rights Reserved.