Commit 4c1b0a8
committed
fix(suppress-warnings): don't clobber concurrent suppressions in finally
`withSuppressedWarnings` snapshotted `process.emitWarning` at entry and
restored that snapshot in `finally`. If another caller had already
installed the suppression wrapper (via `suppressMaxListenersWarning()`
or a prior `suppressWarningType()`), the snapshot was the wrapper
itself — restoring it was a harmless no-op. But if this was the first
caller, the snapshot was the native `emitWarning` and the `finally`
uninstalled the wrapper we just put in place. Any later
`suppressWarningType()` calls would see `originalEmitWarning` already
set and skip the re-wrap, so subsequent suppressions silently stopped
working — a spooky-action regression that's hard to diagnose.
The wrapper is data-driven by the `suppressedWarnings` set, so
"restoring" simply means removing this type from the set. Drop the
`process.emitWarning` reassignment entirely.1 parent 5183fed commit 4c1b0a8
2 files changed
Lines changed: 22 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
163 | | - | |
164 | 163 | | |
165 | 164 | | |
166 | 165 | | |
167 | 166 | | |
168 | | - | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
169 | 174 | | |
170 | 175 | | |
171 | 176 | | |
172 | | - | |
173 | 177 | | |
174 | 178 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
164 | | - | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
165 | 172 | | |
166 | | - | |
167 | | - | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
168 | 177 | | |
169 | | - | |
| 178 | + | |
170 | 179 | | |
171 | | - | |
172 | | - | |
| 180 | + | |
| 181 | + | |
173 | 182 | | |
174 | 183 | | |
175 | 184 | | |
| |||
0 commit comments