Skip to content

Commit 2bec1a3

Browse files
Add an overload of exec(path:args:) which returns Never (#227)
1 parent 21a7918 commit 2bec1a3

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Sources/TSCBasic/misc.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public let executableFileSuffix = ""
2222
/// - Parameters:
2323
/// - path: Absolute path to the executable.
2424
/// - args: The executable arguments.
25-
public func exec(path: String, args: [String]) throws {
25+
public func exec(path: String, args: [String]) throws -> Never {
2626
let cArgs = CStringArray(args)
2727
#if os(Windows)
2828
guard cArgs.cArray.withUnsafeBufferPointer({
@@ -38,6 +38,13 @@ public func exec(path: String, args: [String]) throws {
3838
throw SystemError.exec(errno, path: path, args: args)
3939
}
4040
#endif
41+
fatalError("unreachable")
42+
}
43+
44+
@_disfavoredOverload
45+
@available(*, deprecated, message: "Use the overload which returns Never")
46+
public func exec(path: String, args: [String]) throws {
47+
try exec(path: path, args: args)
4148
}
4249

4350
// MARK: TSCUtility function for searching for executables

0 commit comments

Comments
 (0)