Module: RSpec::Support::ShellOut

### Home Classes Methods

### In Files

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

### Methods

- #run_ruby_with_current_load_path
- #shell_out
- #with_env

### 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::ShellOut

### Constants

FakeProcessStatus

  popen3 doesn't provide the exit status so we fake it out.

### Public Instance Methods

run_ruby_with_current_load_path(ruby_command, *flags) click to toggle source

    # File lib/rspec/support/spec/shell_out.rb, line 41
    def run_ruby_with_current_load_path(ruby_command, *flags)
      command = [
        FileUtils::RUBY,
        "-I#{$LOAD_PATH.map(&:shellescape).join(File::PATH_SEPARATOR)}",
        "-e", ruby_command, *flags
      ]

      # Unset these env vars because `ruby -w` will issue warnings whenever
      # they are set to non-default values.
      with_env 'RUBY_GC_HEAP_FREE_SLOTS' => nil, 'RUBY_GC_MALLOC_LIMIT' => nil,
               'RUBY_FREE_MIN' => nil do
        shell_out(*command)
      end
    end

shell_out(*command) click to toggle source

    # File lib/rspec/support/spec/shell_out.rb, line 20
    def shell_out(*command)
      stdout, stderr, status = Open3.capture3(*command)
      return stdout, filter(stderr), status
    end

with_env(vars) click to toggle source

    # File lib/rspec/support/spec/shell_out.rb, line 8
    def with_env(vars)
      original = ENV.to_hash
      vars.each { |k, v| ENV[k] = v }

      begin
        yield
      ensure
        ENV.replace(original)
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.