wkhtmltopdf icon indicating copy to clipboard operation
wkhtmltopdf copied to clipboard

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

Open garanda21 opened this issue 11 months ago • 2 comments

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

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

garanda21 avatar Sep 12 '23 11:09 garanda21

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.

gwynne avatar Sep 12 '23 12:09 gwynne

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!

garanda21 avatar Sep 13 '23 14:09 garanda21