You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
The --output trigger overwrites previously rendered file #6472
If I render a PDF document with the same name as the .qmd document, i.e. I get test.pdf from test.qmd, then any subsequent rendering using the --output trigger will overwrite test.pdf even though I specify a different name.
Steps to reproduce
Consider a simple document
---
format: pdf
---
Something
and the two commands
quarto render test.qmd
quarto render test.qmd --output test2.pdf
Expected behavior
I would expect two documents test.pdf and test2.pdf.
Actual behavior
I'm only getting the latter as the first is deleted during the second render.
I see, then it is related to #4802.
Quarto creates intermediary/temporary files with the same basename as the Quarto document or Jupyter Notebook. --output is basically just to say to Quarto "move/rename the file to" which means index.pdf is overwritten each time index.qmd is rendered.
Now, because this is the current behaviour of Quarto, the quick and easy workaround is to account for that in the execution order:
quarto render test.qmd --output test2.pdf
quarto render test.qmd
@mcanouil I'm going to open a 1.5 epic for "Execution Planner". It will tackle (and hopefully solve) both parallelization and file overwrite issues. Letting you know so that as you're triaging new features, you know where to put them.
This bug is still present in v1.6. The workaround of 9 Aug 2023 isn't a good fit for many situations. Example:
Student submits work.qmd and work.pdf. I want to render work.qmd to PDF so I can compare, so I quarto render work.qmd -o test.pdf and boom their work.pdf is unexpectedly gone. (Luckily I always put student subs in a git repo so I can revert any accidental changes or deletions back to their submitted state).
Same thing happens if I use --output-dir ./test/ - PDF appears in the folder but the original PDF goes.
Best workaround I have at this point is to copy or symlink the original qmd file to a new name and then render that to a new name.pdf
Activity
mcanouil commentedon Aug 9, 2023
I cannot reproduce using the latest Quarto version.
Screen.Recording.2023-08-09.at.21.52.31.mov
snhansen commentedon Aug 9, 2023
@mcanouil Try with
--output "index.pdf"and--output "index2.pdf". The issue is only when there's a .pdf with the same name as the .qmd.mcanouil commentedon Aug 9, 2023
I see, then it is related to #4802.
Quarto creates intermediary/temporary files with the same basename as the Quarto document or Jupyter Notebook.
--outputis basically just to say to Quarto "move/rename the file to" which meansindex.pdfis overwritten each timeindex.qmdis rendered.Now, because this is the current behaviour of Quarto, the quick and easy workaround is to account for that in the execution order:
cscheid commentedon Aug 14, 2023
@mcanouil I'm going to open a 1.5 epic for "Execution Planner". It will tackle (and hopefully solve) both parallelization and file overwrite issues. Letting you know so that as you're triaging new features, you know where to put them.
barryrowlingson commentedon Dec 13, 2024
This bug is still present in v1.6. The workaround of 9 Aug 2023 isn't a good fit for many situations. Example:
Student submits work.qmd and work.pdf. I want to render work.qmd to PDF so I can compare, so I
quarto render work.qmd -o test.pdfand boom their work.pdf is unexpectedly gone. (Luckily I always put student subs in a git repo so I can revert any accidental changes or deletions back to their submitted state).Same thing happens if I use --output-dir ./test/ - PDF appears in the folder but the original PDF goes.
Best workaround I have at this point is to copy or symlink the original qmd file to a new name and then render that to a new name.pdf