Skip to content

Commit 909c874

Browse files
committed
copy Process.swift from IntegrationTets and add a batSuffix attribute
1 parent e73f6be commit 909c874

File tree

2 files changed

+52
-3
lines changed

2 files changed

+52
-3
lines changed
+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
This source file is part of the Swift.org open source project
3+
4+
Copyright (c) 2014 - 2025 Apple Inc. and the Swift project authors
5+
Licensed under Apache License v2.0 with Runtime Library Exception
6+
7+
See http://swift.org/LICENSE.txt for license information
8+
See http://swift.org/CONTRIBUTORS.txt for Swift project authors
9+
*/
10+
11+
public import Foundation
12+
13+
public enum OperatingSystem: Hashable, Sendable {
14+
case macOS
15+
case windows
16+
case linux
17+
case android
18+
case unknown
19+
}
20+
21+
extension ProcessInfo {
22+
#if os(macOS)
23+
public static let hostOperatingSystem = OperatingSystem.macOS
24+
#elseif os(Linux)
25+
public static let hostOperatingSystem = OperatingSystem.linux
26+
#elseif os(Windows)
27+
public static let hostOperatingSystem = OperatingSystem.windows
28+
#else
29+
public static let hostOperatingSystem = OperatingSystem.unknown
30+
#endif
31+
32+
#if os(Windows)
33+
public static let EOL = "\r\n"
34+
#else
35+
public static let EOL = "\n"
36+
#endif
37+
38+
#if os(Windows)
39+
public static let exeSuffix = ".exe"
40+
#else
41+
public static let exeSuffix = ""
42+
#endif
43+
44+
#if os(Windows)
45+
public static let batSuffix = ".bat"
46+
#else
47+
public static let batSuffix = ""
48+
#endif
49+
}

Tests/BasicsTests/AsyncProcessTests.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ final class AsyncProcessTests: XCTestCase {
144144
}
145145

146146
func testFindExecutable() throws {
147-
try skipOnWindowsAsTestCurrentlyFails(because: "Assertion failure when trying to find ls executable")
147+
try skipOnWindowsAsTestCurrentlyFails(because: "https://github.com/swiftlang/swift-package-manager/issues/8547: Assertion failure when trying to find ls executable")
148148

149149
try testWithTemporaryDirectory { tmpdir in
150150
// This process should always work.
@@ -427,7 +427,7 @@ final class AsyncProcessTests: XCTestCase {
427427
func testAsyncStream() async throws {
428428
// rdar://133548796
429429
try XCTSkipIfCI()
430-
try skipOnWindowsAsTestCurrentlyFails(because: "'swift test' was hanging.")
430+
try skipOnWindowsAsTestCurrentlyFails(because: "https://github.com/swiftlang/swift-package-manager/issues/8547: 'swift test' was hanging.")
431431

432432
let (stdoutStream, stdoutContinuation) = AsyncProcess.ReadableStream.makeStream()
433433
let (stderrStream, stderrContinuation) = AsyncProcess.ReadableStream.makeStream()
@@ -485,7 +485,7 @@ final class AsyncProcessTests: XCTestCase {
485485
func testAsyncStreamHighLevelAPI() async throws {
486486
// rdar://133548796
487487
try XCTSkipIfCI()
488-
try skipOnWindowsAsTestCurrentlyFails(because: "'swift test' was hanging.")
488+
try skipOnWindowsAsTestCurrentlyFails(because: "https://github.com/swiftlang/swift-package-manager/issues/8547: 'swift test' was hanging.")
489489

490490
let result = try await AsyncProcess.popen(
491491
scriptName: "echo\(ProcessInfo.batSuffix)", // maps to 'processInputs/echo' script

0 commit comments

Comments
 (0)