Skip to content

Cannot stream both standardOutput and standardError simultaneously with closure-based run #41

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

Closed
marlimox opened this issue May 9, 2025 · 0 comments · Fixed by #42
Closed
Labels
bug Something isn't working

Comments

@marlimox
Copy link
Contributor

marlimox commented May 9, 2025

Describe the bug
If you try to stream both standardOutput and standardError from the Execution in the closure-based run method, it fails with Fatal error: The standard output has already been consumed.

To Reproduce
Steps to reproduce the behavior:

  1. Attempt to access execution.standardOutput and execution.standardError in the same run closure.

Expected behavior
It should be possible to access both sequenced outputs.

Environment (please complete the following information):

  • OS: macOS 15.4.1 (24E263)
  • Swift version: swiftlang-6.1.0.110.21 clang-1700.0.13.3

Additional context
This looks like a simple copy/paste bug in Execution.swift, the consumption state is checking for .standardOutputConsumed rather than . standardErrorConsumed for the standardError case.

@marlimox marlimox added the bug Something isn't working label May 9, 2025
marlimox added a commit to marlimox/swift-subprocess that referenced this issue May 9, 2025
…be streamed simultaneously with closure-based run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant