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

Fix for Process.run() fails with "Bad file descriptor" and Swift 5.8 #13

Open
wants to merge 1 commit into
base: async
Choose a base branch
from

Conversation

garanda21
Copy link

Small fix for Pipe() error when calling process multiple times and obtain Bad file descriptor error commented here: apple/swift#57827

Also update swift version to 5.8 and updated Process()deprecated methods.

@gwynne
Copy link
Member

gwynne commented Sep 12, 2023

Based on some recent experience dealing with Process's quirks, I'd like to recommend ditching it entirely, in favor of doing what @finestructure and I came up with over in SPI's fork of ShellOut. More specifically, we ended up adopting the version of Process provided by swift-tools-support-core; although TSC is deprecated, its implementation is considerably more robust and modern than the one currently used by swift-corelibs-foundation, and there is as of yet no hint of when swift-foundation will gain this functionality. TSC's version solves the "lost EOF" problem, provides a fully Concurrency-aware API, and handles file descriptors in a much more thread-safe fashion, among other things.

@garanda21
Copy link
Author

Based on some recent experience dealing with Process's quirks, I'd like to recommend ditching it entirely, in favor of doing what @finestructure and I came up with over in SPI's fork of ShellOut. More specifically, we ended up adopting the version of Process provided by swift-tools-support-core; although TSC is deprecated, its implementation is considerably more robust and modern than the one currently used by swift-corelibs-foundation, and there is as of yet no hint of when swift-foundation will gain this functionality. TSC's version solves the "lost EOF" problem, provides a fully Concurrency-aware API, and handles file descriptors in a much more thread-safe fashion, among other things.

I will definitely take a look at ShellOut; I've been having a lot of file descriptor issues on my Linux server. Thanks for your input!

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

Successfully merging this pull request may close these issues.

None yet

2 participants