class Schlib::Command
Attributes
logger[R]
Public Class Methods
new(logger = nil)
click to toggle source
# File lib/schlib/command.rb, line 7 def initialize(logger = nil) @logger = logger end
Public Instance Methods
run(command, approve_exitcode: false)
click to toggle source
# File lib/schlib/command.rb, line 11 def run(command, approve_exitcode: false) logger&.debug command output = `#{command} 2>&1` logger&.debug output if approve_exitcode && !$CHILD_STATUS.success? raise ScriptError, 'COMMAND FAILED!' end output end