pacman icon indicating copy to clipboard operation
pacman copied to clipboard

p_loaded via p_load messes up R session and terminates execution

Open LogIN- opened this issue 6 years ago • 0 comments

Hello, First I want to thank you very much for this amazing package!

I have an issue by running following command, issue happens randomly and I cannot unfortunately give you reproducible example:

p_load(c(package), install = TRUE, update=FALSE, character.only = TRUE)

Error that's terminates script:

# Error in system(paste(which, shQuote(names[i])), intern = TRUE, ignore.stderr = TRUE) : 
# cannot popen '/usr/bin/which 'uname' 2>/dev/null', probable reason 'Cannot allocate memory'
# Calls: p_load ... FUN -> p_install -> p_loaded -> <Anonymous> -> Sys.which

Unfortunately as I can see this happens since p_loaded is called with default arguments and all = FALSE is used as default, that makes utils::sessionInfo() function call https://github.com/trinker/pacman/blob/e20832bbe6dc4c9b4b181f5ae35b2acbc571dbdb/R/p_loaded.R#L56

This is the place where error occurs. I am not sure why sessionInfo is behaving like this in such cases.

To solve this is would be great to pass custom deep arguments from p_load to other functions that p_load is using like p_loaded so we can set all = TRUE for example.

LogIN- avatar Mar 15 '19 15:03 LogIN-