Skip to content

Commit c1a6d83

Browse files
committed
Fix Linux warnings
1 parent e63a2a6 commit c1a6d83

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

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)