Module: RSpec::Support::InSubProcess

### Home Classes Methods

### In Files

- lib/rspec/support/spec/in_sub_process.rb

### Methods

- #in_sub_process
- #in_sub_process_if_possible

### Class/Module Index

Quicksearch

- RSpec
- RSpec::CallerFilter
- RSpec::Support
- RSpec::Support::BlockSignature
- RSpec::Support::Differ
- RSpec::Support::DirectoryMaker
- RSpec::Support::EncodedString
- RSpec::Support::FormattingSupport
- RSpec::Support::FuzzyMatcher
- RSpec::Support::HunkGenerator
- RSpec::Support::InSubProcess
- RSpec::Support::LooseSignatureVerifier
- RSpec::Support::LooseSignatureVerifier::SignatureWithKeywordArgumentsMatcher
- RSpec::Support::MethodSignature
- RSpec::Support::MethodSignatureVerifier
- RSpec::Support::OS
- RSpec::Support::ObjectFormatter
- RSpec::Support::RecursiveConstMethods
- RSpec::Support::Ruby
- RSpec::Support::RubyFeatures
- RSpec::Support::ShellOut
- RSpec::Support::Spec
- RSpec::Support::StdErrSplitter
- RSpec::Support::StrictSignatureVerifier
- RSpec::Support::Version
- RSpec::Support::VersionChecker
- RSpec::Support::Warnings
- RSpec::Support::WithIsolatedStdErr
- Object
- RSpecHelpers

No matching classes.

# RSpec::Support::InSubProcess

### Public Instance Methods

in_sub_process(prevent_warnings=true) click to toggle source

rubocop:disable MethodLength

    # File lib/rspec/support/spec/in_sub_process.rb, line 9
    def in_sub_process(prevent_warnings=true)
      readme, writeme = IO.pipe

      pid = Process.fork do
        exception = nil
        warning_preventer = $stderr = RSpec::Support::StdErrSplitter.new($stderr)

        begin
          yield
          warning_preventer.verify_no_warnings! if prevent_warnings
        rescue Exception => e
          exception = e
        end

        writeme.write Marshal.dump(exception)

        readme.close
        writeme.close
        exit! # prevent at_exit hooks from running (e.g. minitest)
      end

      writeme.close
      Process.waitpid(pid)

      exception = Marshal.load(readme.read)
      readme.close

      raise exception if exception
    end

Also aliased as: in_sub_process_if_possible
in_sub_process_if_possible(prevent_warnings=true) click to toggle source

rubocop:enable MethodLength

Alias for: in_sub_process

[Validate]

Generated with the Darkfish Rdoc Generator 2.