Commit f771aea
committed
fix(hooks): rotation falls back to truncate-in-place on Windows
The Rust agent flagged this real concern: on Windows, the tailer's
open `File` handle can keep `fs.renameSync(out → out.1)` from
succeeding. First time the producer tries to rotate while the
inspector is tailing, the rename throws — and our previous catch-all
swallowed the error so the file would just keep growing.
Try rename first (preserves history in .1 on POSIX). If rename
fails (Windows file lock), truncate-in-place to 0 bytes. The
inspector's tail mode already handles truncation-as-rotation via
the `metadata.len() < read_offset` check, so the consumer side is
unchanged.
Tradeoff: on Windows we lose the .1 archive across rotations, but
events keep flowing — that's the right priority.1 parent 6e16997 commit f771aea
1 file changed
Lines changed: 12 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
86 | 92 | | |
87 | 93 | | |
88 | 94 | | |
89 | 95 | | |
90 | 96 | | |
91 | | - | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
92 | 103 | | |
93 | 104 | | |
94 | 105 | | |
| |||
0 commit comments