Package rife.bld.extension
Class ExecOperation
Executes a command on the command line.
- Since:
- 1.0
- Author:
- Erik C. Thauvin
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncommand()Returns the command and arguments to be executed.Configures the command and arguments to be executed.command(Collection<String> args) Configures the command and arguments to be executed.voidexecute()Executes the command.failOnExit(boolean failOnExit) Configures whether the operation should fail if the command exit value/status is not 0.fromProject(BaseProject project) Configures an Exec operation from aBaseProject.static booleanisAix()Determines if the current operating system is AIX.static booleanisCygwin()Determines if the current operating system is Cygwin.booleanReturns whether the operation should fail if the command exit value/status is not 0.static booleanDetermines if the current operating system is FreeBSD.static booleanisLinux()Determines if the operating system is Linux.static booleanisMacOS()Determines if the current operating system is macOS.static booleanisMingw()Determines if the current operating system is MinGW.static booleanDetermines if the current operating system is OpenVMS.static booleanDetermines if the current operating system is Solaris.static booleanDetermines if the current operating system is Windows.inttimeout()Returns the command timeout.timeout(int timeout) Configure the command timeout.workDir()Returns the working directory.Configures the working directory.Configures the working directory.Configures the working directory.Methods inherited from class rife.bld.operations.AbstractOperation
executeOnce, executeOnce, silent, silent
-
Constructor Details
-
ExecOperation
public ExecOperation()
-
-
Method Details
-
execute
Executes the command.- Specified by:
executein classAbstractOperation<ExecOperation>- Throws:
Exception
-
isAix
public static boolean isAix()Determines if the current operating system is AIX.- Returns:
trueif the operating system is identified as AIX,falseotherwise
-
isCygwin
public static boolean isCygwin()Determines if the current operating system is Cygwin.- Returns:
trueif the operating system is identified as Cygwin,falseotherwise
-
isFreeBsd
public static boolean isFreeBsd()Determines if the current operating system is FreeBSD.- Returns:
trueif the operating system is FreeBSD,falseotherwise
-
isLinux
public static boolean isLinux()Determines if the operating system is Linux.- Returns:
trueif the operating system is Linux,falseotherwise
-
isMacOS
public static boolean isMacOS()Determines if the current operating system is macOS.- Returns:
trueif the OS is macOS,falseotherwise
-
isMingw
public static boolean isMingw()Determines if the current operating system is MinGW.- Returns:
trueif the operating system is identified as MinGW,falseotherwise
-
isOpenVms
public static boolean isOpenVms()Determines if the current operating system is OpenVMS.- Returns:
trueif the operating system is OpenVMS,falseotherwise
-
isSolaris
public static boolean isSolaris()Determines if the current operating system is Solaris.- Returns:
trueif the operating system is Solaris,falseotherwise
-
isWindows
public static boolean isWindows()Determines if the current operating system is Windows.- Returns:
trueif the operating system is Windows,falseotherwise
-
command
Configures the command and arguments to be executed.For example:
command("cmd", "/c", "stop.bat")command("./stop.sh"
- Parameters:
arg- one or more arguments- Returns:
- this operation instance
- See Also:
-
command
Returns the command and arguments to be executed.- Returns:
- the command and arguments
-
command
Configures the command and arguments to be executed.- Parameters:
args- the list of arguments- Returns:
- this operation instance
- See Also:
-
failOnExit
Configures whether the operation should fail if the command exit value/status is not 0.Default is
TRUE- Parameters:
failOnExit- The fail on exit toggle- Returns:
- this operation instance.
-
fromProject
Configures an Exec operation from aBaseProject.The
work directoryis automatically set to the project's working directory.- Parameters:
project- the project- Returns:
- this operation instance
-
isFailOnExit
public boolean isFailOnExit()Returns whether the operation should fail if the command exit value/status is not 0.- Returns:
trueorfalse
-
timeout
Configure the command timeout.- Parameters:
timeout- The timeout in seconds- Returns:
- this operation instance
-
timeout
public int timeout()Returns the command timeout.- Returns:
- the timeout
-
workDir
Configures the working directory.- Parameters:
dir- the directory- Returns:
- this operation instance
-
workDir
Configures the working directory.- Parameters:
dir- the directory- Returns:
- this operation instance
-
workDir
Configures the working directory.- Parameters:
dir- the directory path- Returns:
- this operation instance
-
workDir
Returns the working directory.- Returns:
- the directory
-