如果我运行此代码:
svn_output = %x[svn update /Users/radek/Sites/db2.rft -r 11105 --force ]
puts
puts " output is =#{svn_output}="
我得到了这个结果
svn: Working copy '/Users/radek/Sites/db2.rft' locked
svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details)
output is ==
但是我希望变量svn_output
中的svn出现错误消息。这可能吗?
答案 0 :(得分:12)
您想将stderr重定向到stdout:
svn_output = %x[svn update /Users/radek/Sites/db2.rft -r 11105 --force 2>&1]
puts
puts " output is =#{svn_output}="