Method: Sh#run
- Defined in:
- lib/command/sh/sh.rb
#run(command) ⇒ Object
Run a bash command locally.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/command/sh/sh.rb', line 10 def run(command) output = '' exit_status = nil Open3.popen3(command) do |_stdin, stdout, stderr, wait_thr| stdout.each_line do |line| puts line output += line end stderr.each_line do |line| puts line output += line end exit_status = wait_thr.value return { output: output, result: exit_status.success? } end end |