Skip to content

Commit 5d82aef

Browse files
committed
Update the swift-system package dependency requirement to 1.4.2
1.4.0 introduced FileDescriptor.pipe() on Windows, use that implementation instead of duplicating it, which also resolves an ambiguous overload issue in the tests on newly cloned repos. 1.4.2 also has some FreeBSD and OpenBSD fixes and since this repo has some support for those platforms, we should pull it in as well.
1 parent 8bec498 commit 5d82aef

File tree

3 files changed

+2
-39
lines changed

3 files changed

+2
-39
lines changed

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ let availabilityMacro: SwiftSetting = .enableExperimentalFeature(
1010
var dep: [Package.Dependency] = [
1111
.package(
1212
url: "https://github.com/apple/swift-system",
13-
from: "1.0.0"
13+
from: "1.4.2"
1414
)
1515
]
1616
#if !os(Windows)

[email protected]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ let package = Package(
1919
dependencies: [
2020
.package(
2121
url: "https://github.com/apple/swift-system",
22-
from: "1.0.0"
22+
from: "1.4.2"
2323
),
2424
.package(
2525
url: "https://github.com/apple/swift-docc-plugin",

Sources/Subprocess/Platforms/Subprocess+Windows.swift

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -976,43 +976,6 @@ internal typealias PlatformFileDescriptor = HANDLE
976976

977977
// MARK: - Pipe Support
978978
extension FileDescriptor {
979-
internal static func pipe() throws -> (
980-
readEnd: FileDescriptor,
981-
writeEnd: FileDescriptor
982-
) {
983-
var saAttributes: SECURITY_ATTRIBUTES = SECURITY_ATTRIBUTES()
984-
saAttributes.nLength = DWORD(MemoryLayout<SECURITY_ATTRIBUTES>.size)
985-
saAttributes.bInheritHandle = true
986-
saAttributes.lpSecurityDescriptor = nil
987-
988-
var readHandle: HANDLE? = nil
989-
var writeHandle: HANDLE? = nil
990-
guard CreatePipe(&readHandle, &writeHandle, &saAttributes, 0),
991-
readHandle != INVALID_HANDLE_VALUE,
992-
writeHandle != INVALID_HANDLE_VALUE,
993-
let readHandle: HANDLE = readHandle,
994-
let writeHandle: HANDLE = writeHandle
995-
else {
996-
throw SubprocessError(
997-
code: .init(.failedToCreatePipe),
998-
underlyingError: .init(rawValue: GetLastError())
999-
)
1000-
}
1001-
let readFd = _open_osfhandle(
1002-
intptr_t(bitPattern: readHandle),
1003-
FileDescriptor.AccessMode.readOnly.rawValue
1004-
)
1005-
let writeFd = _open_osfhandle(
1006-
intptr_t(bitPattern: writeHandle),
1007-
FileDescriptor.AccessMode.writeOnly.rawValue
1008-
)
1009-
1010-
return (
1011-
readEnd: FileDescriptor(rawValue: readFd),
1012-
writeEnd: FileDescriptor(rawValue: writeFd)
1013-
)
1014-
}
1015-
1016979
var platformDescriptor: PlatformFileDescriptor {
1017980
return HANDLE(bitPattern: _get_osfhandle(self.rawValue))!
1018981
}

0 commit comments

Comments
 (0)