Package com.sshtools.common.command
Interface ExecutableCommand
- All Superinterfaces:
Component
- All Known Implementing Classes:
AbstractExecutableCommand,NativeExecutableCommand,ScpCommand
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intValue returned fromgetExitCode()to indicate that the process is still active. -
Method Summary
Modifier and TypeMethodDescriptionbooleanallocatePseudoTerminal(String term, int cols, int rows, int width, int height, byte[] modes) booleancreateProcess(String[] args, Map<String, String> environment) Create the process but wait for theonStart()method before performing any IO.intGet the exit code for this process.Get the STDIN InputStream for this process.Get the STDOUT OutputStream for this process.Get the STDERR OutputStream for this process.voidinit(SessionChannelServer session) Initialize the command.voidkill()Kill the command.voidonStart()Called once the command has been started.voidstart()Start the command.
-
Field Details
-
STILL_ACTIVE
static final int STILL_ACTIVEValue returned fromgetExitCode()to indicate that the process is still active.- See Also:
-
-
Method Details
-
init
Initialize the command. This can be overridden but always call this super method with the command's session.- Parameters:
session-
-
getSession
SessionChannel getSession() -
createProcess
Create the process but wait for theonStart()method before performing any IO.- Parameters:
cmd-environment-- Returns:
- boolean
-
start
void start()Start the command. -
onStart
void onStart()Called once the command has been started. Operations within this method SHOULD NOT block as this will cause the connection to lockup. -
kill
void kill()Kill the command. -
getExitCode
int getExitCode()Get the exit code for this process. If the process has not completed returnSTILL_ACTIVE.- Returns:
- int
-
getOutputStream
OutputStream getOutputStream()Get the STDOUT OutputStream for this process.- Returns:
- OutputStream
-
getStderrOutputStream
OutputStream getStderrOutputStream()Get the STDERR OutputStream for this process.- Returns:
- OutputStream
-
getInputStream
InputStream getInputStream()Get the STDIN InputStream for this process.- Returns:
- InputStream
-
allocatePseudoTerminal
boolean allocatePseudoTerminal(String term, int cols, int rows, int width, int height, byte[] modes)
-