Package com.owc.gradle
Class SystemUtility
java.lang.Object
com.owc.gradle.SystemUtility
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionexecuteShellCommand(String command) Executes a shell command and return the output as multiline stringstatic StringgetEnvironmentVariableOrFail(String variableKey) Extracts the system environment variable value and fails if the value is not presentstatic StringgetEnvironmentVariableOrNull(String variableKey) Extracts the system environment variable value.
-
Constructor Details
-
SystemUtility
public SystemUtility() -
SystemUtility
-
-
Method Details
-
executeShellCommand
Executes a shell command and return the output as multiline string- Parameters:
command- the command to execute- Returns:
- multiline string representing the result of
- Throws:
IOException- if any error happens during the execution of the command, or a stream was closed by the system
-
getEnvironmentVariableOrFail
Extracts the system environment variable value and fails if the value is not present- Parameters:
variableKey- the requested variable key- Returns:
- variable value
- Throws:
IOException- if the environment variable is not defined
-
getEnvironmentVariableOrNull
Extracts the system environment variable value. It may return null if the variable is not defined- Parameters:
variableKey- the requested variable key- Returns:
- variable value or null if not defined
-