Skip to content
This repository
tree: 06b045c7ae
Fetching contributors…

Cannot retrieve contributors at this time

file 28 lines (24 sloc) 0.616 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
module RunShell

  # Runs a shell command and pipes output to console.
  def runshell(cmd, ignoreerrors=false)
    puts "+ #{cmd}"
    IO.popen("#{cmd} 2>&1", 'r') do |output|
      output.sync = true
      done = false
      while !done
        begin
          puts output.readline
        rescue EOFError
          done = true
        end
      end
    end

    exitstatus = $?.exitstatus
    fail "SHELL COMMAND FAILED - exit code #{exitstatus}" unless (ignoreerrors || $?.success?)
    return exitstatus
  end

  # for Windows-specific tasks.
  def is_windows?
    return !!(RUBY_PLATFORM =~ /mswin/)
  end

end
Something went wrong with that request. Please try again.