Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/62.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails RSpec模拟系统调用间歇性地在Jenkins CI上产生$?.exitstatus 127_Ruby On Rails_Unit Testing_Rspec_Jenkins_Exit Code - Fatal编程技术网

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
的存根来解决这个问题,因此这更像是一个满足我好奇心的问题