Skip to content

Commit 583c593

Browse files
authored
Add tests for Basics/AsyncProcess (swiftlang#7824)
`AsyncProcess` replicates `TSCBasic.Process` with additions that make it easier to use with Swift Concurrency. To date we didn't replicate the test suite for it, this PR aims to fix that omission.
1 parent 5f38882 commit 583c593

File tree

10 files changed

+573
-2
lines changed

10 files changed

+573
-2
lines changed

Package.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,11 @@ let package = Package(
619619
"Archiver/Inputs/archive.zip",
620620
"Archiver/Inputs/invalid_archive.tar.gz",
621621
"Archiver/Inputs/invalid_archive.zip",
622+
"processInputs/long-stdout-stderr",
623+
"processInputs/exit4",
624+
"processInputs/simple-stdout-stderr",
625+
"processInputs/deadlock-if-blocking-io",
626+
"processInputs/in-to-out",
622627
]
623628
),
624629
.testTarget(

Sources/Basics/AsyncProcess.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ package final class AsyncProcess {
173173
case stdinUnavailable
174174
}
175175

176+
package typealias OutputStream = AsyncStream<[UInt8]>
177+
176178
package enum OutputRedirection {
177179
/// Do not redirect the output
178180
case none

Sources/Basics/Environment/Environment.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import Darwin.C
2626
#endif
2727

2828
// FIXME: Use Synchronization.Mutex when available
29-
class Mutex<T>: @unchecked Sendable {
29+
private final class Mutex<T>: @unchecked Sendable {
3030
var lock: NSLock
3131
var value: T
3232

@@ -118,7 +118,7 @@ extension Environment {
118118
// MARK: - Global Environment
119119

120120
extension Environment {
121-
static let _cachedCurrent = Mutex<Self?>(value: nil)
121+
fileprivate static let _cachedCurrent = Mutex<Self?>(value: nil)
122122

123123
/// Vends a copy of the current process's environment variables.
124124
///

0 commit comments

Comments
 (0)