Commit 6956881
fix: unique-per-call probe file in copy_article_images()
When two or more workers render articles from the same source
directory in parallel, the fixed filename
<path_dir(input_path)>/--find-assets.html
written by copy_article_images() collides between workers, surfacing as
[EEXIST] Failed to copy '<built>.html' to '<src>/--find-assets.html':
file already exists
[ENOENT] Failed to remove '<src>/--find-assets.html':
no such file or directory
depending on whether the failing worker raced on the file_copy or on
its sibling's deferred file_delete. The race is observable with as
few as two workers and bites reliably at >= 6 workers on a 400-
vignette package (see nlmixr2/nlmixr2lib PR #427, run 26225121646).
The probe file has to live next to the input Rmd so the relative
paths in the built HTML resolve when rmarkdown::find_external_resources
reads them back; tempdir() would break that. Generate a unique
filename per call via tempfile(pattern = "--find-assets-", tmpdir =
path_dir(input_path), fileext = ".html") so concurrent workers in the
same source directory each get their own probe.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 001e6f5 commit 6956881
2 files changed
Lines changed: 14 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
5 | 7 | | |
6 | 8 | | |
7 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
260 | 260 | | |
261 | 261 | | |
262 | 262 | | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
268 | 275 | | |
269 | 276 | | |
270 | 277 | | |
| |||
0 commit comments