diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..818bf86 --- /dev/null +++ b/Makefile @@ -0,0 +1,43 @@ +macos-5.5: + @echo + @echo === Building $@ === + env DEVELOPER_DIR=/Applications/Xcode-13.2.1.app xcrun swift build + +macos-5.6: + @echo + @echo === Building $@ === + env DEVELOPER_DIR=/Applications/Xcode-13.4.1.app xcrun swift build + +macos-5.7: + @echo + @echo === Building $@ === + env DEVELOPER_DIR=/Applications/Xcode-14.2.0.app xcrun swift build + +linux-5.5: + @echo + @echo === Building $@ === + docker run --rm -v "$(PWD)":/host -w /host "swift:5.5-focal" swift build + +linux-5.6: + @echo + @echo === Building $@ === + docker run --rm -v "$(PWD)":/host -w /host "swift:5.6-focal" swift build + +linux-5.7: + @echo + @echo === Building $@ === + docker run --rm -v "$(PWD)":/host -w /host "swift:5.7-focal" swift build + +linux: \ + linux-5.5 \ + linux-5.6 \ + linux-5.7 + +macos: \ + macos-5.5 \ + macos-5.6 \ + macos-5.7 + +all: \ + macos \ + linux diff --git a/Sources/ShellOut.swift b/Sources/ShellOut.swift index d4e76a5..c2b957c 100644 --- a/Sources/ShellOut.swift +++ b/Sources/ShellOut.swift @@ -398,7 +398,11 @@ extension ShellOutCommand { private extension Process { @discardableResult func launchBash(with command: String, outputHandle: FileHandle? = nil, errorHandle: FileHandle? = nil, environment: [String : String]? = nil) throws -> String { +#if os(Linux) + executableURL = URL(fileURLWithPath: "/bin/bash") +#else launchPath = "/bin/bash" +#endif arguments = ["-c", command] if let environment = environment { @@ -438,7 +442,11 @@ private extension Process { } #endif +#if os(Linux) + try run() +#else launch() +#endif #if os(Linux) outputQueue.sync {