Ruby on rails RSpec模拟系统调用间歇性地在Jenkins CI上产生$?.exitstatus 127
我们使用模拟方法进行系统调用:Ruby on rails RSpec模拟系统调用间歇性地在Jenkins CI上产生$?.exitstatus 127,ruby-on-rails,unit-testing,rspec,jenkins,exit-code,Ruby On Rails,Unit Testing,Rspec,Jenkins,Exit Code,我们使用模拟方法进行系统调用: before do subject.stub(:`) { `(exit 0)` } end ... #when running the tests we check the result of the last shell command using $? if $?.exitstatus == 0 # some code end 这在MacOSX上使用JRuby1.7.9在本地工作。但是,当构建器使用jenkins CI执行这些相同的测试时,我们会得
before do
subject.stub(:`) { `(exit 0)` }
end
...
#when running the tests we check the result of the last shell command using $?
if $?.exitstatus == 0
# some code
end
这在MacOSX上使用JRuby1.7.9在本地工作。但是,当构建器使用jenkins CI执行这些相同的测试时,我们会得到一个间歇的结果$?。exitstatus==127
。由于存根指向只应返回退出代码0的子shell,这非常奇怪
我的问题是:
造成这种差异的可能原因是什么?
linux变量$?
与ruby调用$?.exitstatus
之间是否存在一些差异,这可能导致得到不一致的结果?
此后,我们通过实现一个关于如何检索exitstatus
的存根来解决这个问题,因此这更像是一个满足我好奇心的问题