Package org.dellroad.jct.core
Interface ShellSession
- All Superinterfaces:
ConsoleSession<Shell,ShellRequest>
- All Known Implementing Classes:
AbstractShellSession,JShellShellSession,SimpleShell.Session
A
ConsoleSession associated with an interactive shell.
Note that shell sessions do not have distinct output and error streams. Instead, there is only one output stream, namely, the stream that ultimately gets displayed on the user's terminal. This stream is used for both normal and error output. However, it would be possible for a session to do clever things like displaying normal and error output in different colors, etc.
-
Method Summary
Modifier and TypeMethodDescriptiondefault PrintStreamGet this session's error output stream.intGet the current exit value, if any.booleansetExitValue(int exitValue) Signal to the shell that it should exit with the specified exit value.Methods inherited from interface org.dellroad.jct.core.ConsoleSession
execute, getInputStream, getOutputStream, getOwner, getRequest, interrupt
-
Method Details
-
setExitValue
boolean setExitValue(int exitValue) Signal to the shell that it should exit with the specified exit value.Whether the
exitValueis meaningful and what to do with it (if anything) is up to the shell.- Parameters:
exitValue- integer exit value- Returns:
- true if successful, false if setting exit value is unsupported or otherwise not possible
-
getExitValue
int getExitValue()Get the current exit value, if any.- Returns:
- exit value, or zero if none set or not available
-
getErrorStream
Get this session's error output stream.The default implementation in
ShellSessionjust returnsthis.getOutputStream().- Specified by:
getErrorStreamin interfaceConsoleSession<Shell,ShellRequest> - Returns:
- session error output
-