Skip to content

Commit

Permalink
more robust force package unload for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
jjallaire committed Dec 9, 2012
1 parent 02a1752 commit 234a50f
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/cpp/session/modules/SessionPackages.R
Expand Up @@ -133,14 +133,20 @@

.rs.addFunction("forceUnloadPackage", function(name)
{
if (name %in% .packages())
{
fullName <- paste("package:", name, sep="")
detach(fullName, character.only=TRUE, force=TRUE)
pkgDLL <- getLoadedDLLs()[[name]]
if (!is.null(pkgDLL))
dyn.unload(pkgDLL[["path"]])
}
if (name %in% .packages())
{
fullName <- paste("package:", name, sep="")
suppressWarnings(detach(fullName,
character.only=TRUE,
unload=TRUE,
force=TRUE))

pkgDLL <- getLoadedDLLs()[[name]]
if (!is.null(pkgDLL)) {
suppressWarnings(library.dynam.unload(name,
system.file(package=name)))
}
}
})

.rs.addFunction("libPathsString", function()
Expand Down

0 comments on commit 234a50f

Please sign in to comment.