Skip to content

Commit 9cbd13d

Browse files
committed
Fix deprecated launchPath and launch API on Process
1 parent 2853d7d commit 9cbd13d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Sources/markdown-tool/Commands/FormatCommand.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,16 @@ extension MarkdownCommand {
126126
/// Search for the an executable with a given base name.
127127
func findExecutable(named name: String) throws -> String? {
128128
let which = Process()
129-
which.launchPath = "/usr/bin/which"
130129
which.arguments = [name]
131130
let standardOutput = Pipe()
132131
which.standardOutput = standardOutput
133-
which.launch()
132+
if #available(macOS 10.13, *) {
133+
which.executableURL = URL(fileURLWithPath: "/usr/bin/which")
134+
try which.run()
135+
} else {
136+
which.launchPath = "/usr/bin/which"
137+
which.launch()
138+
}
134139
which.waitUntilExit()
135140

136141
guard which.terminationStatus == 0,

0 commit comments

Comments
 (0)