Package com.sshtools.common.command
Class NativeExecutableCommand
java.lang.Object
com.sshtools.common.command.AbstractExecutableCommand
com.sshtools.common.command.NativeExecutableCommand
- All Implemented Interfaces:
ExecutableCommand,Component
A further extension of the
AbstractExecutableCommand that provides the
ability to execute a native process. Caution should be taken with this
current implementation as no processing of EOL is provided and results may
vary on different platforms. It is recommended that only automated clients
use this feature due to the many differences in user terminals which may
cause problems with command output not performing as expected.-
Nested Class Summary
Nested classes/interfaces inherited from interface com.sshtools.common.command.ExecutableCommand
ExecutableCommand.ExecutableCommandFactory<T extends ExecutableCommand> -
Field Summary
Fields inherited from class com.sshtools.common.command.AbstractExecutableCommand
sessionFields inherited from interface com.sshtools.common.command.ExecutableCommand
STILL_ACTIVE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancreateProcess(String[] commandLine, Map<String, String> environment) Create the process but wait for theAbstractExecutableCommand.onStart()method before performing any IO.intGet the exit code for this process.voidkill()Kill the command.voidonStart()Called once the command has been started.Methods inherited from class com.sshtools.common.command.AbstractExecutableCommand
allocatePseudoTerminal, getInputStream, getOutputStream, getSession, getStderrOutputStream, init, start
-
Constructor Details
-
NativeExecutableCommand
public NativeExecutableCommand()
-
-
Method Details
-
onStart
public void onStart()Description copied from class:AbstractExecutableCommandCalled once the command has been started. Operations within this method SHOULD NOT block as this will cause the connection to lockup.- Specified by:
onStartin interfaceExecutableCommand- Specified by:
onStartin classAbstractExecutableCommand
-
getExitCode
public int getExitCode()Description copied from class:AbstractExecutableCommandGet the exit code for this process. If the process has not completed returnExecutableCommand.STILL_ACTIVE.- Specified by:
getExitCodein interfaceExecutableCommand- Specified by:
getExitCodein classAbstractExecutableCommand- Returns:
- int
-
createProcess
Description copied from class:AbstractExecutableCommandCreate the process but wait for theAbstractExecutableCommand.onStart()method before performing any IO.- Specified by:
createProcessin interfaceExecutableCommand- Specified by:
createProcessin classAbstractExecutableCommand- Returns:
- boolean
-
kill
public void kill()Description copied from class:AbstractExecutableCommandKill the command.- Specified by:
killin interfaceExecutableCommand- Specified by:
killin classAbstractExecutableCommand
-