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

Buffering/backpressure issue #62

Open
finestructure opened this issue Mar 4, 2024 · 0 comments
Open

Buffering/backpressure issue #62

finestructure opened this issue Mar 4, 2024 · 0 comments

Comments

@finestructure
Copy link
Contributor

As discussed on Slack, there seems to be an issue around buffering or back pressure support when logging output from Citadel.

I'm running a task as follows:

        let stream = try await executeCommandStream("script.sh", inShell: true)
        for try await output in stream {
            switch output {
                case let .stdout(buffer):
                    print(String(buffer: buffer), terminator: "")
                case let .stderr(buffer):
                    print(String(buffer: buffer), terminator: "")
            }
        }

where "script.sh" is a simple

echo "❌  this must fail"
exit 1

but the echo isn't showing up in the logs.

An ugly fix for this is to introduce a delay before exiting:

echo "❌  this must fail"
sleep 0.1
exit 1

Best I can tell, there's no way on the consumer side of the AsyncThorwingStream to ensure all messages have been delivered before the stream terminates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant