feature/host-inspect-cli
swift 21 lines 524 Bytes
Raw
1 #if os(macOS)
2 import Foundation
3 import XCRSHostInspect
4
5 let result = HostInspectCommand.invoke(arguments: Array(CommandLine.arguments.dropFirst()))
6
7 if !result.standardOutput.isEmpty {
8 FileHandle.standardOutput.write(Data(result.standardOutput.utf8))
9 }
10 if !result.standardError.isEmpty {
11 FileHandle.standardError.write(Data(result.standardError.utf8))
12 }
13
14 exit(result.exitCode)
15 #else
16
17 // The helper drives the macOS window server and Vision, so on any other
18 // platform it has nothing to do but fail.
19 exit(1)
20
21 #endif