Skip to content

Commit

Permalink
Fix iOS/tvOS/watchOS build by adding missing availability annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
jakepetroules committed Feb 10, 2023
1 parent e6cdd33 commit 2985f64
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Sources/TSCBasic/Process.swift
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,7 @@ extension Process {
/// - environment: The environment to pass to subprocess. By default the current process environment
/// will be inherited.
/// - loggingHandler: Handler for logging messages
@available(macOS 10.15, *)
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
static public func popen(
arguments: [String],
environment: [String: String] = ProcessEnv.vars,
Expand All @@ -999,7 +999,7 @@ extension Process {
/// - environment: The environment to pass to subprocess. By default the current process environment
/// will be inherited.
/// - loggingHandler: Handler for logging messages
@available(macOS 10.15, *)
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
static public func popen(
args: String...,
environment: [String: String] = ProcessEnv.vars,
Expand All @@ -1016,7 +1016,7 @@ extension Process {
/// will be inherited.
/// - loggingHandler: Handler for logging messages
/// - Returns: The process output (stdout + stderr).
@available(macOS 10.15, *)
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
@discardableResult
static public func checkNonZeroExit(
arguments: [String],
Expand All @@ -1039,7 +1039,7 @@ extension Process {
/// will be inherited.
/// - loggingHandler: Handler for logging messages
/// - Returns: The process output (stdout + stderr).
@available(macOS 10.15, *)
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
@discardableResult
static public func checkNonZeroExit(
args: String...,
Expand Down
5 changes: 5 additions & 0 deletions Tests/TSCBasicTests/ProcessTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class ProcessTests: XCTestCase {
}
}

@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
func testPopenAsync() async throws {
#if os(Windows)
let args = ["where.exe", "where"]
Expand Down Expand Up @@ -122,6 +123,7 @@ class ProcessTests: XCTestCase {
}
}

@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
func testCheckNonZeroExitAsync() async throws {
do {
let output = try await Process.checkNonZeroExit(args: "echo", "hello")
Expand Down Expand Up @@ -344,6 +346,7 @@ class ProcessTests: XCTestCase {
}
}

@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
func testStdoutStdErrAsync() async throws {
// A simple script to check that stdout and stderr are captured separatly.
do {
Expand Down Expand Up @@ -490,6 +493,7 @@ fileprivate extension Process {
return try checkNonZeroExit(args: script(scriptName), environment: environment, loggingHandler: loggingHandler)
}

@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
static func checkNonZeroExit(
scriptName: String,
environment: [String: String] = ProcessEnv.vars,
Expand All @@ -510,6 +514,7 @@ fileprivate extension Process {
return try popen(arguments: [script(scriptName)], environment: Self.env(), loggingHandler: loggingHandler)
}

@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
@discardableResult
static func popen(
scriptName: String,
Expand Down

0 comments on commit 2985f64

Please sign in to comment.