class Del::ShellCommand
Executes shell commands and pipes the results back to the caller.
Public Class Methods
new(command)
click to toggle source
# File lib/del/shell_command.rb, line 7 def initialize(command) @command = Array(command).flatten.join(' ') end
Public Instance Methods
run() { |line| ... }
click to toggle source
# File lib/del/shell_command.rb, line 11 def run Open3.popen3(@command) do |_stdin, stdout, stderr, wait_thr| stdout.each_line { |line| yield line } stderr.each_line { |line| yield line } wait_thr.value.success? end end