Sha256: 8c31d108d80b72995b7d715e417367ccb83223b7b13b3a2d108aa1e64467f67c

Contents?: true

Size: 247 Bytes

Versions: 11

Compression:

Stored size: 247 Bytes

Contents

module WithExitstatus
  def with_exitstatus_returning(code)
    saved_exitstatus = $?.nil? ? 0 : $?.exitstatus
    begin
      `ruby -e "exit #{code.to_i}"`
      yield
    ensure
      `ruby -e "exit #{saved_exitstatus.to_i}"`
    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
cocaine-0.5.1 spec/support/with_exitstatus.rb
cocaine-0.5.0 spec/support/with_exitstatus.rb
cocaine-0.4.2 spec/support/with_exitstatus.rb
cocaine-0.4.1 spec/support/with_exitstatus.rb
cocaine-0.4.0 spec/support/with_exitstatus.rb
cocaine-0.3.2 spec/support/with_exitstatus.rb
cocaine-0.3.1 spec/support/with_exitstatus.rb
cocaine-0.3.0 spec/support/with_exitstatus.rb
radiant-1.0.0 ruby-debug/ruby/1.8/gems/cocaine-0.2.1/spec/support/with_exitstatus.rb
cocaine-0.2.1 spec/support/with_exitstatus.rb
cocaine-0.2.0 spec/support/with_exitstatus.rb