class Binpkgbot::Tasks::Run
Public Instance Methods
run()
click to toggle source
# File lib/binpkgbot/tasks/run.rb, line 9 def run script = [*@options[:script],*@options[:scripts]].join("\n") if @options[:host] puts script.each_line.map.with_index { |_,i| "#{(i.zero? ? "$ " : " ")}#{_}" }.join(?\n) r,w = IO.pipe w.puts script pid = spawn('bash', in: r) r.close w.close _, status = Process.waitpid2(pid) if !status.success? raise "host run failed #{status.inspect}, #{command_line.inspect}" end else emerge_runner(script, ephemeral: @options.key?(:persist) ? !@options[:persist] : false) end end