Module: Formatron::Util::Shell

Defined in:
lib/formatron/util/shell.rb

Overview

wrapper for shelling out calls so that we can still test

Class Method Summary collapse

Class Method Details

.exec(command) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/formatron/util/shell.rb', line 8

def self.exec(command)
  Open3.popen2e command do |_stdin, stdout_err, wait_thr|
    # rubocop:disable Lint/AssignmentInCondition
    while line = stdout_err.gets
      # rubocop:enable Lint/AssignmentInCondition
      Formatron::LOG.info line.chomp
    end
    return wait_thr.value.success?
  end
end