ShellOut
ShellOut copied to clipboard
Updated to Swift 5.1 and fixed deprecations
I noticed, while building Publish with Swift 5.1 on Linux, that ShellOut was giving build warnings related to launchPath and launch() being deprecated. As I was investigating, I found that several of the tests were not running on Linux, and were actually failing when included. This PR addresses the following issues:
- Added missing tests to
ShellOutTests.allTests. - The
#if oschecks inProcess.launchBash(with:outputHandle:errorHandle:)are no longer needed, asFileHandle.readabilityHandlerwas implemented and merged in Swift 5.1. This means both macOS and Linux can use the same code paths (this was not true when d18b7b6 was committed). This also fixes most of the tests. - Added
if #available(OSX 10.13, *)checks to useexecutableURLandrun()on current macOS and Linux targets. Defaults to the older API on earlier versions of macOS. This gets rid of the build warnings. - Changed
testSingleCommandAtPathContainingTilde()to run at~/..(typically/Userson macOS and/homeon Linux) instead of~. This is because Swift docker images, which are one of the easier ways to test Swift on Linux, have an empty home directory by default, and thus fail this test. By contrast,~/..must contain at least~, and still tests that paths with~work.
I think this should cut a new version release, as it changes the minimum Swift version from 4.2 to 5.1.