Skip to content

Commit

Permalink
Add an overload of exec(path:args:) which returns Never (swiftlang#227
Browse files Browse the repository at this point in the history
)
  • Loading branch information
jakepetroules authored Jun 23, 2021
1 parent 21a7918 commit 2bec1a3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Sources/TSCBasic/misc.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public let executableFileSuffix = ""
/// - Parameters:
/// - path: Absolute path to the executable.
/// - args: The executable arguments.
public func exec(path: String, args: [String]) throws {
public func exec(path: String, args: [String]) throws -> Never {
let cArgs = CStringArray(args)
#if os(Windows)
guard cArgs.cArray.withUnsafeBufferPointer({
Expand All @@ -38,6 +38,13 @@ public func exec(path: String, args: [String]) throws {
throw SystemError.exec(errno, path: path, args: args)
}
#endif
fatalError("unreachable")
}

@_disfavoredOverload
@available(*, deprecated, message: "Use the overload which returns Never")
public func exec(path: String, args: [String]) throws {
try exec(path: path, args: args)
}

// MARK: TSCUtility function for searching for executables
Expand Down

0 comments on commit 2bec1a3

Please sign in to comment.