Interface ShellSession

All Superinterfaces:
ConsoleSession<Shell,ShellRequest>
All Known Implementing Classes:
AbstractShellSession, JShellShellSession, SimpleShell.Session

public interface ShellSession extends ConsoleSession<Shell,ShellRequest>
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 Details

    • setExitValue

      boolean setExitValue(int exitValue)
      Signal to the shell that it should exit with the specified exit value.

      Whether the exitValue is 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

      default PrintStream getErrorStream()
      Get this session's error output stream.

      The default implementation in ShellSession just returns this.getOutputStream().

      Specified by:
      getErrorStream in interface ConsoleSession<Shell,ShellRequest>
      Returns:
      session error output