Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure that data is buffered instead of discarded #61

Merged
merged 1 commit into from Mar 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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