Class CommandHandlerImpl
- java.lang.Object
-
- com.microsoft.azure.toolkit.lib.legacy.function.handlers.CommandHandlerImpl
-
- All Implemented Interfaces:
CommandHandler
public class CommandHandlerImpl extends Object implements CommandHandler
-
-
Constructor Summary
Constructors Constructor Description CommandHandlerImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static String[]buildCommand(String command)protected StringgetOutputFromProcess(Process process)protected static ProcessBuilder.RedirectgetStdoutRedirect(boolean showStdout)protected voidhandleExitValue(int exitValue, List<Long> validReturnCodes, String errorMessage, InputStream inputStream)protected ProcessrunCommand(String command, boolean showStdout, String workingDirectory)StringrunCommandAndGetOutput(String command, boolean showStdout, String workingDirectory)voidrunCommandWithReturnCodeCheck(String command, boolean showStdout, String workingDirectory, List<Long> validReturnCodes, String errorMessage)protected voidshowErrorIfAny(InputStream inputStream)
-
-
-
Method Detail
-
runCommandWithReturnCodeCheck
public void runCommandWithReturnCodeCheck(String command, boolean showStdout, String workingDirectory, List<Long> validReturnCodes, String errorMessage) throws com.microsoft.azure.toolkit.lib.common.exception.AzureExecutionException
- Specified by:
runCommandWithReturnCodeCheckin interfaceCommandHandler- Throws:
com.microsoft.azure.toolkit.lib.common.exception.AzureExecutionException
-
runCommandAndGetOutput
public String runCommandAndGetOutput(String command, boolean showStdout, String workingDirectory) throws com.microsoft.azure.toolkit.lib.common.exception.AzureExecutionException
- Specified by:
runCommandAndGetOutputin interfaceCommandHandler- Throws:
com.microsoft.azure.toolkit.lib.common.exception.AzureExecutionException
-
getOutputFromProcess
protected String getOutputFromProcess(Process process) throws IOException
- Throws:
IOException
-
runCommand
protected Process runCommand(String command, boolean showStdout, String workingDirectory) throws IOException, InterruptedException
- Throws:
IOExceptionInterruptedException
-
getStdoutRedirect
protected static ProcessBuilder.Redirect getStdoutRedirect(boolean showStdout)
-
handleExitValue
protected void handleExitValue(int exitValue, List<Long> validReturnCodes, String errorMessage, InputStream inputStream) throws com.microsoft.azure.toolkit.lib.common.exception.AzureExecutionException, IOException- Throws:
com.microsoft.azure.toolkit.lib.common.exception.AzureExecutionExceptionIOException
-
showErrorIfAny
protected void showErrorIfAny(InputStream inputStream) throws IOException
- Throws:
IOException
-
-