Commit 7d96821
committed
watcher_mgmt: declare explicit error sets to survive comptime branch removal
CI ReleaseFast caught this: declaring `discoverWatchers`, `getActiveCwds`,
and `stopWatcher` with an inferred error set (`!T`) on a non-Windows
target caused the Windows-only `error.WatcherNotSupportedOnPlatform`
branch to be eliminated at type-analysis time. The error then wasn't
in the function's error set, so the catch-and-switch handlers in
`main.zig` failed compile with:
expected ... error_set, found 'error{WatcherNotSupportedOnPlatform}'
The local `zig build test` (Debug) compiled fine because the catch
sites are only reached on the failure path, and the Debug pipeline
doesn't run the same dead-branch analysis. ReleaseFast does.
Fix: declare explicit error sets at the top of `watcher_mgmt.zig`:
- `PlatformError = error{WatcherNotSupportedOnPlatform}`
- `StopError = error{WatcherNotSupportedOnPlatform, SignalFailed}`
Then:
- `discoverWatchers(...) (PlatformError || anyerror)!...`
- `getActiveCwds(...) (PlatformError || anyerror)!...`
- `stopWatcher(pid) StopError!void`
`anyerror` on the first two covers the `runCommand` and downstream
errors without needing to enumerate them. Both Debug and ReleaseFast
build clean now.1 parent d0c2110 commit 7d96821
1 file changed
Lines changed: 11 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
119 | 127 | | |
120 | | - | |
| 128 | + | |
121 | 129 | | |
122 | 130 | | |
123 | 131 | | |
| |||
140 | 148 | | |
141 | 149 | | |
142 | 150 | | |
143 | | - | |
| 151 | + | |
144 | 152 | | |
145 | 153 | | |
146 | 154 | | |
| |||
157 | 165 | | |
158 | 166 | | |
159 | 167 | | |
160 | | - | |
| 168 | + | |
161 | 169 | | |
162 | 170 | | |
163 | 171 | | |
| |||
0 commit comments