Sha256: 96bd412d4ec9edc58f88a524c5665f1c4aef619e1921293fcb48ed943bd37ea3

Contents?: true

Size: 418 Bytes

Versions: 6

Compression:

Stored size: 418 Bytes

Contents

module Cocaine
  class CommandLine
    class BackticksRunner

      def call(command, env = {})
        with_modified_environment(env) do
          `#{command}`
        end
      end

      private

      def with_modified_environment(env)
        begin
          saved_env = ENV.to_hash
          ENV.update(env)
          yield
        ensure
          ENV.update(saved_env)
        end
      end

    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
cocaine-0.4.2 lib/cocaine/command_line/runners/backticks_runner.rb
cocaine-0.4.1 lib/cocaine/command_line/runners/backticks_runner.rb
cocaine-0.4.0 lib/cocaine/command_line/runners/backticks_runner.rb
cocaine-0.3.2 lib/cocaine/command_line/runners/backticks_runner.rb
cocaine-0.3.1 lib/cocaine/command_line/runners/backticks_runner.rb
cocaine-0.3.0 lib/cocaine/command_line/runners/backticks_runner.rb