futureverse / parallelly

R package: parallelly - Enhancing the 'parallel' Package
https://parallelly.futureverse.org
130 stars 7 forks source link

Add assert_system_is_supported() #90

Closed HenrikBengtsson closed 1 year ago

HenrikBengtsson commented 1 year ago

It could be that the operating system is so locked down that the user cannot call external software via system(), which can lead to obscure errors such as:

Error in system(cmd, intern = TRUE, input = input) : 
  'CreateProcess' failed to run 'some_external_software'

Adding an internal assert_system_is_supported() that checks this, and gives an informative error message when not supported, would be useful. It could, for instance, test that:

out <- system2(file.path(R.home("bin"), "Rscript"), args = "--version", stdout = TRUE)

works. The result could be memoized, so that the test is one done once per R process.