Sha256: b0d74673ce6a817880e0b1e4b97142966500a7a4c3301200108564546e6b8123

Contents?: true

Size: 478 Bytes

Versions: 5

Compression:

Stored size: 478 Bytes

Contents

module RSCM
  class Better
    @@logger = nil
    @@logger = RSCM_DEFAULT_LOGGER
    
    def self.popen(cmd, mode="r", expected_exit=0, &proc)
      @@logger.info "Executing command: '#{cmd}'" if @@logger
      ret = IO.popen(cmd, mode) do |io|
        proc.call(io)
      end
      exit_code = $? >> 8
      raise "Command\n'#{cmd}'\nfailed with code #{exit_code} in\n#{Dir.pwd}\nExpected exit code: #{expected_exit}" if exit_code != expected_exit
      ret
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rscm-0.3.3 lib/rscm/better.rb
rscm-0.3.4 lib/rscm/better.rb
rscm-0.3.0 lib/rscm/better.rb
rscm-0.3.1 lib/rscm/better.rb
rscm-0.3.2 lib/rscm/better.rb