Skip to content

Clean temp files on exit - #820

Merged
yihui merged 7 commits into
rstudio:masterfrom
yihui:bugfix/clean-tempfiles
Oct 18, 2017
Merged

yihui merged 7 commits into
rstudio:masterfrom
yihui:bugfix/clean-tempfiles

Conversation

@yihui

@yihui yihui commented Sep 30, 2016 •

Copy link
Copy Markdown
Collaborator

This PR fixes #819: a few temp files are never cleaned up after render() is done. I went through the code that called tempfile(), and added on.exit(unlink()) to clean up those temp files. The as_tmpfile() ones are a little tricky, since they cannot be immediately removed and we need to wait until pandoc_convert() is done, so I added clean_tmpfiles() in render(), hoping that the pattern rmarkdown-str is unique and it does not hurt to aggressively clean up files in tempdir() that happen to have the same pattern but not created by as_tmpfile().

@jjallaire

Copy link
Copy Markdown
Member

We are getting ready to submit rmarkdown to CRAN so I'm going to hold off on merging this PR until then.

@yihui

yihui commented Sep 30, 2016

Copy link
Copy Markdown
Collaborator Author

Sure. No problem. I don't think this bug will affect many users.

@yihui yihui added this to the v1.7 milestone Oct 16, 2017
@yihui
yihui merged commit 18ab0d5 into rstudio:master Oct 18, 2017
@yihui
yihui deleted the bugfix/clean-tempfiles branch October 18, 2017 03:22
@yihui yihui mentioned this pull request Oct 18, 2017
3 tasks done
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Nov 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Temp files are left on disk

2 participants