Skip to content

Commit

Permalink
Make sure that data is buffered instead of discarded
Browse files Browse the repository at this point in the history
  • Loading branch information
Joannis committed Mar 4, 2024
1 parent 6717f73 commit 22c969a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Sources/Citadel/TTY/Client/TTY.swift
Expand Up @@ -155,7 +155,7 @@ extension SSHClient {
/// - inShell: Whether to request the remote server to start a shell before executing the command.
public func executeCommandStream(_ command: String, inShell: Bool = false) async throws -> AsyncThrowingStream<ExecCommandOutput, Error> {
var streamContinuation: AsyncThrowingStream<ExecCommandOutput, Error>.Continuation!
let stream = AsyncThrowingStream<ExecCommandOutput, Error> { continuation in
let stream = AsyncThrowingStream<ExecCommandOutput, Error>(bufferingPolicy: .unbounded) { continuation in
streamContinuation = continuation
}

Expand Down Expand Up @@ -218,11 +218,11 @@ extension SSHClient {
public func executeCommandPair(_ command: String, inShell: Bool = false) async throws -> ExecCommandStream {
var stdoutContinuation: AsyncThrowingStream<ByteBuffer, Error>.Continuation!
var stderrContinuation: AsyncThrowingStream<ByteBuffer, Error>.Continuation!
let stdout = AsyncThrowingStream<ByteBuffer, Error> { continuation in
let stdout = AsyncThrowingStream<ByteBuffer, Error>(bufferingPolicy: .unbounded) { continuation in
stdoutContinuation = continuation
}

let stderr = AsyncThrowingStream<ByteBuffer, Error> { continuation in
let stderr = AsyncThrowingStream<ByteBuffer, Error>(bufferingPolicy: .unbounded) { continuation in
stderrContinuation = continuation
}

Expand Down

0 comments on commit 22c969a

Please sign in to comment.