我编写了一个Ruby脚本,在执行该脚本的某个时刻,它将运行bundle install
以从Gemfile安装gem。这是相关的部分:
puts "installing gems ..."
puts `bundle install --without production`
puts "gems installed."
这里发生的是,尽管该bundle install
命令已正确执行,但仅在安装所有gem后,我才在CLI中看到输出。意思是我先得到installing gems ...
然后等待,然后我将bundle install
加上gems installed
消息的所有输出行放在一起。
有一种bundle install
在执行时实时逐行显示输出的方法吗?
一种选择是使用Kernel#system
而不是反引号:
system "bundle install --without production"
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句