Sha256: 5d5fea6f10d2610b03f219b2ad8baf821c2029ef6854e46ba67d93b1cd27257f
Contents?: true
Size: 592 Bytes
Versions: 5
Compression:
Stored size: 592 Bytes
Contents
require "singleton" class CommandExecutor include Singleton attr_accessor :verbose class CommandFailed < StandardError; end def instance @verbose = false end # execute command # # @param [String] command execute command # @param [Boolean] verbose log for the command # @param [Boolean] exception raise exception if the command failed def execute!(command, verbose: @verbose, exception: true) puts "cmd: #{command}" if verbose ret, err, status = Open3.capture3(command) raise CommandFailed.new(err) if exception && !status.success? ret end end
Version data entries
5 entries across 5 versions & 1 rubygems