Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix iOS/tvOS/watchOS build by adding missing availability annotations #394

Merged
merged 3 commits into from
Feb 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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