SessionChannel

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override val exitInfo: Deferred<SessionExit?>

Completes with how the remote process terminated once the server reports it (RFC 4254 section 6.10), or with null when the channel closes without an exit-status/exit-signal notification. Servers are not required to send one, so null means unknown, not failure.

Link copied to clipboard
open override val isOpen: Boolean
Link copied to clipboard
open override val localChannelNumber: Int
Link copied to clipboard
open override val remoteChannelNumber: Int
Link copied to clipboard
open override val stderr: ReceiveChannel<ByteArray>

Standard error, with the same drain and explicit-close contract as stdout.

Link copied to clipboard
open override val stdout: ReceiveChannel<ByteArray>

Standard output. Data received before remote channel close remains readable through automatic connection teardown. Explicit session close or client disconnect discards it.

Functions

Link copied to clipboard
open override fun close()

Discard unread output and release delivery resources, including after remote close.

Link copied to clipboard
open suspend override fun read(): ByteArray?
Link copied to clipboard
open suspend override fun readExtended(): Pair<Int, ByteArray>?

Read non-stderr extended data. RFC 4254 data type 1 is exposed exclusively through stderr so the same remote bytes are not buffered twice.

Link copied to clipboard
open suspend override fun requestEnv(name: String, value: String): Boolean

Request an environment variable for this session (RFC 4254 section 6.4). Call before requesting a shell, command, or subsystem. Servers may restrict names (OpenSSH uses AcceptEnv) and reject requests after process startup. Names and values are encoded as UTF-8. Returns false for NUL-containing input, a closed channel, or server rejection; rejection does not close the session.

Link copied to clipboard
open suspend override fun requestExec(command: String): Boolean

Request execution of a command on this session channel (RFC 4254 section 6.5).

Link copied to clipboard
open suspend override fun requestPty(terminalType: String = "xterm", widthChars: Int = 80, heightRows: Int = 24, widthPixels: Int = 0, heightPixels: Int = 0, terminalModes: ByteArray = byteArrayOf(0)): Boolean
Link copied to clipboard
open suspend override fun requestShell(): Boolean
Link copied to clipboard
open suspend override fun requestSubsystem(name: String): Boolean

Request a subsystem on this session channel (RFC 4254 section 6.5).

Link copied to clipboard
open suspend override fun resizeTerminal(widthChars: Int, heightRows: Int, widthPixels: Int, heightPixels: Int): Boolean
Link copied to clipboard
open suspend override fun sendEof()
Link copied to clipboard
open suspend override fun write(data: ByteArray)

Write data, suspending for channel window credit and transport backpressure.