class Getch::Make

Public Class Methods

new(cmd) click to toggle source
# File lib/getch/command.rb, line 104
def initialize(cmd)
  @gentoo = MOUNTPOINT
  @cmd = cmd
  @log = Getch::Log.new
end

Public Instance Methods

run!() click to toggle source
# File lib/getch/command.rb, line 110
def run!
  @log.info "Running Make: #{@cmd}"
  cmd = "chroot #{@gentoo} /bin/bash -c \"source /etc/profile \
    && env-update \
    && cd /usr/src/linux \
    && #{@cmd}\""
  Open3.popen2e(cmd) do |stdin, stdout_err, wait_thr|
    while line = stdout_err.gets
      puts line
    end

    exit_status = wait_thr.value
    unless exit_status.success?
      @log.fatal "Running #{cmd}"
      exit 1
    end
  end
end