我正在从Ruby脚本中执行对rvm use ...
的调用:
system "rvm use 2.5.5"
执行以上操作后,我得到
RVM is not a function, selecting rubies with 'rvm use ...' will not work.
You need to change your terminal emulator preferences to allow login shell.
我相当确定我以登录Shell身份登录。在我打开的终端中使用普通的RVM命令没有问题。 system
命令是在当前shell上启动还是默认使用其他命令?如果使用其他方法,让Ruby在当前shell上下文中运行命令的最佳方法是什么?
答案 0 :(得分:1)
使用RVM,这些事情可能会很棘手。试试这个:
"/bin/bash -c -l 'rvm use 2.5.5 && <add your system commands here>'"
注意:我想它将创建一个 new 外壳环境。您真的需要访问您的 current 外壳程序吗?