9c560b9e
fix: a temp directory that will not delete now says so
a73x 2026-08-08 18:23
Commit message
src/testtmp.zig
| Old | New | ||
|---|---|---|---|
| @@ -51,7 +51,18 @@ pub const TmpDir = struct { | |||
| 51 | if (self.len == 0) return; | 51 | if (self.len == 0) return; |
| 52 | const p = self.path(); | 52 | const p = self.path(); |
| 53 | self.dir.close(); | 53 | self.dir.close(); |
| 54 | std.fs.cwd().deleteTree(p) catch {}; | 54 | // Said out loud rather than swallowed. A `catch {}` here has the |
| 55 | // shape this project has been bitten by before: a failure whose | ||
| 56 | // false branch is indistinguishable from success, so a directory | ||
| 57 | // that could not be removed looks exactly like one that was. It | ||
| 58 | // stays non-fatal — a test that passed must not be failed by its own | ||
| 59 | // tidying — but it stops being silent, because the difference | ||
| 60 | // between "the suite leaves nothing behind" and "the suite leaves | ||
| 61 | // things behind and never mentions it" is a whole afternoon of | ||
| 62 | // hunting when something else starts leaking. | ||
| 63 | std.fs.cwd().deleteTree(p) catch |err| { | ||
| 64 | std.debug.print("testtmp: could not remove {s}: {t}\n", .{ p, err }); | ||
| 65 | }; | ||
| 55 | self.len = 0; | 66 | self.len = 0; |
| 56 | } | 67 | } |
| 57 | }; | 68 | }; |