Skip to content
Open
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
12 changes: 6 additions & 6 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions Sources/SwiftCommand/ChildProcess.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ import Foundation
import WinSDK
#endif

#if os(macOS) || os(iOS)
import Darwin
#elseif canImport(Glibc)
import Glibc
#elseif canImport(Musl)
import Musl
#elseif os(Windows)
import ucrt
#else
Comment on lines +14 to +16
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#elseif os(Windows)
import ucrt
#else
#elseif !os(Windows)

ucrt isn't used at all in this file.

#error("Unknown platform")
#endif

/// Handle to a running or exited child process
///
/// This class is used to represent and manage child processes. A child process
Expand Down Expand Up @@ -721,6 +733,8 @@ where Stdin: InputSource, Stdout: OutputDestination, Stderr: OutputDestination {
Darwin.kill(self.process.processIdentifier, SIGKILL)
#elseif canImport(Glibc)
Glibc.kill(self.process.processIdentifier, SIGKILL)
#elseif canImport(Musl)
Musl.kill(self.process.processIdentifier, SIGKILL)
#else
#error("Unsupported platform!")
#endif
Expand Down
16 changes: 16 additions & 0 deletions Sources/SwiftCommand/FileHandle+Async.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
import Foundation

#if os(macOS) || os(iOS)
import Darwin
#elseif canImport(Glibc)
import Glibc
#elseif canImport(Musl)
import Musl
#elseif os(Windows)
import ucrt
#else
#error("Unknown platform")
#endif

fileprivate final actor IOActor {
#if !os(Windows)
fileprivate func read(
Expand All @@ -11,6 +23,10 @@ fileprivate final actor IOActor {
let read = Darwin.read
#elseif canImport(Glibc)
let read = Glibc.read
#elseif canImport(Musl)
let read = Musl.read
#elseif os(Windows)
let read = ucrt.read
Comment on lines +28 to +29
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#elseif os(Windows)
let read = ucrt.read

We are already in an #if !os(Windows) here.

#else
#error("Unsupported platform!")
#endif
Expand Down