Package fi.evolver.script
Class Shell.Command
java.lang.Object
fi.evolver.script.Shell.Command
- Enclosing class:
Shell
-
Method Summary
Modifier and TypeMethodDescriptionbinaryStdout(boolean value) Set an environment variable for the command.failOnError(boolean value) Sets whether the command should fail on non-zero exit value.booleanisSudo()Is this command run with root privileges.run()Execute the command.runAsync()Execute the command asynchronously.stdin(InputStream data) Add standard input for the command.Add standard input for the command.static Shell.CommandCreate a new command run with super user privileges.static Shell.CommandCreate a new command run with super user privileges.toString()static Shell.CommandCreate a new command run with the current user's privileges.static Shell.CommandCreate a new command run with the current user's privileges.workingDirectory(Path path)
-
Method Details
-
env
Set an environment variable for the command.- Parameters:
variable- The variable name.value- The value for the variable.- Returns:
- This command for chaining purposes.
-
stdin
Add standard input for the command.- Parameters:
data- Data to add to the standard input stream.- Returns:
- This command for chaining purposes.
-
stdin
Add standard input for the command.- Parameters:
data- Data to add to the standard input stream.- Returns:
- This command for chaining purposes.
-
failOnError
Sets whether the command should fail on non-zero exit value.- Parameters:
value- Should the command fail on error.- Returns:
- This command for chaining purposes.
-
workingDirectory
-
binaryStdout
-
isSudo
public boolean isSudo()Is this command run with root privileges.- Returns:
- Whether this command uses sudo.
-
toString
-
user
Create a new command run with the current user's privileges.- Parameters:
command- The command to run.- Returns:
- The created command.
-
user
Create a new command run with the current user's privileges.- Parameters:
command- The command to run.- Returns:
- The created command.
-
sudo
Create a new command run with super user privileges.- Parameters:
command- The command to run.- Returns:
- The created command.
-
sudo
Create a new command run with super user privileges.- Parameters:
command- The command to run.- Returns:
- The created command.
-
run
Execute the command.- Returns:
- The results of the command.
-
runAsync
Execute the command asynchronously.- Returns:
- The future result of the command.
-