Commit e1599ee
committed
fix: trace2 watcher basename matching and concurrent flush/watcher race
Bug 1: fs.watch provides basename-only paths on most platforms, so the
comparison against the full absolute traceFilePath never matched. Now
compares using path.basename() so the watcher correctly triggers
readTraceDelta for real-time hook progress streaming.
Bug 2: readTraceDelta is shared between the forked watcher fiber and
the flush call. Both could enter concurrently at the async readFileString
boundary, causing duplicate line processing. Wraps readTraceDelta with a
Semaphore(1) mutex to serialize access to processedChars and lineBuffer.1 parent 7984dc0 commit e1599ee
1 file changed
+26
-19
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
361 | 362 | | |
362 | 363 | | |
363 | 364 | | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | | - | |
375 | | - | |
376 | | - | |
377 | | - | |
378 | | - | |
379 | | - | |
380 | | - | |
381 | | - | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
382 | 386 | | |
383 | 387 | | |
| 388 | + | |
384 | 389 | | |
385 | 390 | | |
386 | 391 | | |
387 | | - | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
388 | 395 | | |
389 | 396 | | |
390 | 397 | | |
| |||
0 commit comments