Sha256: f2475d6e933776cc6d6787e02a4b7fb797b7f6d6a571377e2d7a94c6552c68ad
Contents?: true
Size: 631 Bytes
Versions: 8
Compression:
Stored size: 631 Bytes
Contents
require 'open3' module TerraformDevKit class Command def self.run(cmd, directory: Dir.pwd, print_output: true) Open3.popen2e(cmd, chdir: directory) do |_, stdout_and_stderr, thread| output = process_output(stdout_and_stderr, print_output) thread.join raise "Error running command #{cmd}" unless thread.value.success? return output end end private_class_method def self.process_output(stream, print_output) lines = [] until (line = stream.gets).nil? print line if print_output lines << line.strip end lines end end end
Version data entries
8 entries across 8 versions & 1 rubygems