Sha256: 330bc32cf2255e340a17d086a28b14fdb273218e938068cd8dfd599bec3414c1
Contents?: true
Size: 646 Bytes
Versions: 1
Compression:
Stored size: 646 Bytes
Contents
module EZAPIClient class ExecCommand include Virtus.model attribute :command, String def self.call(command, logger = nil) self.new(command: command).(logger) end def call(logger = nil) stdout_str, stderr_str, status = Open3.capture3(command) unless status.success? error_msgs = [ stdout_str, stderr_str, ].reject { |str| str == "" }.compact.join("; ") msg = ["Error executing command:", error_msgs].join(" ") logger.error(EZAPIClient::LOG_PROGNAME) { msg } if logger fail ArgumentError, msg end stdout_str.chomp end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ezapi_client-1.2.1 | lib/ezapi_client/services/exec_command.rb |