I am trying to add a protocol which has all the attributes and functions of a Process but I see a warning with terminationHandler
.
I was hoping not to see this warning since @Sendable
is already added to terminationHandler
.
protocol ProcessProtocol {
var executableURL: URL? { get set }
var arguments: [String]? { get set }
var environment: [String : String]? { get set }
var currentDirectoryURL: URL? { get set }
var standardInput: Any? { get set }
var standardOutput: Any? { get set }
var standardError: Any? { get set }
func run() throws
func interrupt()
func terminate()
func suspend() -> Bool
func resume() -> Bool
var processIdentifier: Int32 { get }
var isRunning: Bool { get }
var terminationStatus: Int32 { get }
var terminationReason: Process.TerminationReason { get }
var terminationHandler: (@Sendable (Process) -> Void)? { get set }
var qualityOfService: QualityOfService { get set }
}
extension Process: ProcessProtocol {}
It is a bit odd indeed, because your protocol signature exactly matches what the Developer Documentation signature shows for
Process - terminationHandler
. Removing the@Sendable
notation actually resolves the warning, not sure why. I'd submit a bug report to Apple regarding this.