@@ -47,7 +47,9 @@ public class FSWatch {
4747 self . paths = paths
4848 self . latency = latency
4949
50- #if canImport(Glibc)
50+ #if os(OpenBSD)
51+ self . _watcher = NoOpWatcher ( paths: paths, latency: latency, delegate: _WatcherDelegate ( block: block) )
52+ #elseif canImport(Glibc)
5153 var ipaths : [ AbsolutePath : Inotify . WatchOptions ] = [ : ]
5254
5355 // FIXME: We need to recurse here.
@@ -93,17 +95,37 @@ private protocol _FileWatcher {
9395 func stop( )
9496}
9597
96- #if canImport(Glibc)
98+ #if os(OpenBSD)
99+ extension FSWatch . _WatcherDelegate : NoOpWatcherDelegate { }
100+ extension NoOpWatcher : _FileWatcher { }
101+ #elseif canImport(Glibc)
97102extension FSWatch . _WatcherDelegate : InotifyDelegate { }
98103extension Inotify : _FileWatcher { }
99104#elseif os(macOS)
100105extension FSWatch . _WatcherDelegate : FSEventStreamDelegate { }
101106extension FSEventStream : _FileWatcher { }
107+ #else
108+ #error("Implementation required")
102109#endif
103110
104111// MARK:- inotify
105112
106- #if canImport(Glibc)
113+ #if os(OpenBSD)
114+
115+ public protocol NoOpWatcherDelegate {
116+ func pathsDidReceiveEvent( _ paths: [ AbsolutePath ] )
117+ }
118+
119+ public final class NoOpWatcher {
120+ public init ( paths: [ AbsolutePath ] , latency: Double , delegate: NoOpWatcherDelegate ? = nil ) {
121+ }
122+
123+ public func start( ) throws { }
124+
125+ public func stop( ) { }
126+ }
127+
128+ #elseif canImport(Glibc)
107129
108130/// The delegate for receiving inotify events.
109131public protocol InotifyDelegate {
0 commit comments