unload namespace before reinstalling, #4403#4404
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4404 +/- ##
=======================================
Coverage 99.60% 99.60%
=======================================
Files 72 72
Lines 13970 13970
=======================================
Hits 13915 13915
Misses 55 55 Continue to review full report at Codecov.
|
|
codecov fail is false positive |
|
We might not even need R -q
unload = function() {unloadNamespace("pkg"); !"pkg"%in%loadedNamespaces()}
utils::package.skeleton("pkg", list="unload")
q("no")
rm pkg/man/unload.Rd
R CMD build pkg
R CMD INSTALL pkg_1.0.tar.gz
R -q
library(pkg)
unload()
#[1] TRUE |
| on.exit({ | ||
| if (upg) { | ||
| unloadNamespace(pkg) | ||
| utils::install.packages(pkg, repos=repo, type=type, lib=lib, ...) |
There was a problem hiding this comment.
Maybe wrap this with a tryCatch()? Just so that a more helpful error message can be produced instead; e.g. "Please close all R sessions to release the dll lock on Windows, and try again. If the dll lock is still open, try a reboot which should release the lock on Windows. Also, if you have a .Rpofile which loads data.table on startup, turn that off temporarily in order to upgrade the dll on Windows."
There was a problem hiding this comment.
.Rprofile should not be an issue, because DT is already loaded at this point.
There was a problem hiding this comment.
I would lean towards keeping on.exit chunk as simple as possible
closes #4403