Handle failure cases in rvm module

Fixes potential tracebacks when _rvm() and _rvm_do() fail. Fixes #5889.