Skip to content

Swift Subprocess hangs in release builds but works in debug builds #182

@kattouf

Description

@kattouf

Describe the bug

Swift Subprocess library hangs indefinitely when built in release configuration, while working correctly in debug configuration. The Subprocess.run() call never completes when running a simple ls command in release builds.

To Reproduce
What executable was running? ls
2. What arguments are passed in? No arguments (just ls)
3. What environment values are used? Default environment

Code example:

let result = try await Subprocess.run(.name("ls"), output: .string(limit: 4096))

I reproduced this issue here: https://github.com/kattouf/swift-subprocess-hang-report

Expected behavior
The Subprocess.run() call should complete successfully and return the process result with output, process identifier, and termination status.

Environment (please complete the following information):

  • OS macOS - 15
  • Swift version - swift-driver version: 1.120.5 Apple Swift version 6.1.2 (swiftlang-6.1.2.1.2 clang-1700.0.13.5)
    Target: arm64-apple-macosx15.0

Additional context
I reproduced this issue with both release 0.1.0 and the main branch.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions