Skip to content

Commit db112a2

Browse files
Merge pull request #1 from SwiftPackageIndex/fix-warnings
Fix warnings on Linux
2 parents f5dedb9 + c1a6d83 commit db112a2

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

Makefile

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
macos-5.5:
2+
@echo
3+
@echo === Building $@ ===
4+
env DEVELOPER_DIR=/Applications/Xcode-13.2.1.app xcrun swift build
5+
6+
macos-5.6:
7+
@echo
8+
@echo === Building $@ ===
9+
env DEVELOPER_DIR=/Applications/Xcode-13.4.1.app xcrun swift build
10+
11+
macos-5.7:
12+
@echo
13+
@echo === Building $@ ===
14+
env DEVELOPER_DIR=/Applications/Xcode-14.2.0.app xcrun swift build
15+
16+
linux-5.5:
17+
@echo
18+
@echo === Building $@ ===
19+
docker run --rm -v "$(PWD)":/host -w /host "swift:5.5-focal" swift build
20+
21+
linux-5.6:
22+
@echo
23+
@echo === Building $@ ===
24+
docker run --rm -v "$(PWD)":/host -w /host "swift:5.6-focal" swift build
25+
26+
linux-5.7:
27+
@echo
28+
@echo === Building $@ ===
29+
docker run --rm -v "$(PWD)":/host -w /host "swift:5.7-focal" swift build
30+
31+
linux: \
32+
linux-5.5 \
33+
linux-5.6 \
34+
linux-5.7
35+
36+
macos: \
37+
macos-5.5 \
38+
macos-5.6 \
39+
macos-5.7
40+
41+
all: \
42+
macos \
43+
linux

Sources/ShellOut.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,11 @@ extension ShellOutCommand {
398398

399399
private extension Process {
400400
@discardableResult func launchBash(with command: String, outputHandle: FileHandle? = nil, errorHandle: FileHandle? = nil, environment: [String : String]? = nil) throws -> String {
401+
#if os(Linux)
402+
executableURL = URL(fileURLWithPath: "/bin/bash")
403+
#else
401404
launchPath = "/bin/bash"
405+
#endif
402406
arguments = ["-c", command]
403407

404408
if let environment = environment {
@@ -438,7 +442,11 @@ private extension Process {
438442
}
439443
#endif
440444

445+
#if os(Linux)
446+
try run()
447+
#else
441448
launch()
449+
#endif
442450

443451
#if os(Linux)
444452
outputQueue.sync {

0 commit comments

Comments
 (0)