r-lib / callr

Call R from R
https://callr.r-lib.org/
Other
297 stars 36 forks source link

Overwritten S3 methods when pak is loaded before callr #254

Open DavisVaughan opened 1 year ago

DavisVaughan commented 1 year ago
x <- pak::pkg_list()
x <- callr::r(function() {})
#> Registered S3 methods overwritten by 'callr':
#>   method                    from
#>   format.callr_status_error     
#>   print.callr_status_error

I imagine it has something to do with this https://github.com/r-lib/pak/blob/580b158493e11f459c0f38a0c3eff77afc018a64/R/subprocess.R#L255-L268

And then callr unconditionally reregisters them here https://github.com/r-lib/callr/blob/e3e0acffdd817bb1c0f7fc5054f93b1d65ed8a45/R/error.R#L148

gaborcsardi commented 5 months ago

This is going to be fixed once pak stops using the subprocess: https://github.com/r-lib/pak/pull/586 I think. I'll leave this open to check.

DavisVaughan commented 5 months ago

Nice!