See: Description
Interface | Description |
---|---|
Command |
Represents an executable path and set of arguments that may be run by an
execution system.
|
Command.Builder |
Builds
Command objects. |
CommandFuture |
A
ListenableFuture that provides access to the output and exit status
of an asynchronous command. |
Class | Description |
---|---|
CommandContext |
Provides command-independent information that influences how commands
execute.
|
CommandContext.Builder |
Builds
CommandContext objects. |
CommandEnvironment |
Describes the environment variables that are present when a
Command
executes. |
CommandExitLatch |
Listener that shuts down an ExecutionSystem after it's been started and all registered
CommandFutures have finished.
|
CommandResult |
Contains the output and exit status of a completed command.
|
Commands |
Static utility methods to create and execute commands.
|
ExecutionSystem |
Provides an interface for command execution and is the factory for command
objects.
|
ExecutionSystems |
Factory methods for execution systems.
|
TerminatedCommand |
A simple container for information about terminated commands.
|
Enum | Description |
---|---|
CommandEnvironment.BaseEnvironment |
Defines the target of environment changes.
|
Exception | Description |
---|---|
ClosedExecutionSystemException |
Runtime exception thrown when methods are called on a closed execution
system.
|
CommandException |
Runtime exception thrown when a command fails, usually by exiting with a
non-zero exit status.
|
CommandTimeoutException |
Checked exception thrown when the timeout for a command is exceeded.
|
ExecutionSystemAlreadyExistsException |
Runtime exception thrown when an attempt is made to create an execution
system that already exists.
|
ExecutionSystemNotFoundException |
Runtime exception thrown when an execution system cannot be found.
|
Executable commands are represented by Command
objects. Each
Command
is associated with an ExecutionSystem
that can
execute the command on a local or remote host. Each ExecutionSystem
is associated with an ExecutionSystemProvider
, which is responsible
for creating systems for different hosts using the same connection method,
for instance SSH.
Most operations on Command
s are defined in Commands
. As an
example:
This executes the "ls" command on the local system, returning an object containing the exit code and output.Command ls = Commands.get("ls", "-a", "-l"); CommandResult result = Commands.execute(ls);
ExecutionSystems.getDefault()
method. There is exactly one instance of the local execution system and
it cannot be closed. Because the local execution system is created automatically,
it does not accept an environment map for configuration. Instead, the following
system properties modify the behavior of the system:
Property | Description |
---|---|
giraffe.command.local.envWhitelist |
A comma-separated list of variable names to keep when creating process environments.
If set, all environment variables not in this whitelist will be removed from the
default environment of new processes.
When using Giraffe in certain applications, such as servers or similar long-lived services, the application processes is started with environment variables that should not be visible to command processes and may even prevent these processes from executing correctly. Setting this property allows users to create a well-defined default environment for command execution. |