File tree Expand file tree Collapse file tree 2 files changed +26
-3
lines changed Expand file tree Collapse file tree 2 files changed +26
-3
lines changed Original file line number Diff line number Diff line change 1
- #if os(Linux )
1
+ #if canImport(Glibc )
2
2
import Glibc
3
- #elseif os(macOS )
3
+ #elseif canImport(Darwin )
4
4
import Darwin
5
5
#else
6
6
#error("unsupported platform")
@@ -115,3 +115,20 @@ extension SystemProcess
115
115
}
116
116
}
117
117
}
118
+ extension SystemProcess
119
+ {
120
+ @MainActor
121
+ public static
122
+ func `do`( _ operation: ( ) async throws -> Void ) async
123
+ {
124
+ do
125
+ {
126
+ try await operation ( )
127
+ }
128
+ catch let error
129
+ {
130
+ print ( error)
131
+ exit ( 1 )
132
+ }
133
+ }
134
+ }
Original file line number Diff line number Diff line change @@ -9,7 +9,13 @@ import UnidocAPI
9
9
enum Main
10
10
{
11
11
static
12
- func main( ) async throws
12
+ func main( ) async
13
+ {
14
+ await SystemProcess . do ( Self . _main)
15
+ }
16
+
17
+ private static
18
+ func _main( ) async throws
13
19
{
14
20
let options : Options = try . parse( )
15
21
You can’t perform that action at this time.
0 commit comments