wkhtmltopdf
wkhtmltopdf copied to clipboard
Fix for Process.run() fails with "Bad file descriptor" and Swift 5.8
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.
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.
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 ofProcess
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!