class Unixoid::Runner
Constants
- LOG_FILE
Public Class Methods
new()
click to toggle source
# File lib/unixoid/runner.rb, line 10 def initialize @logger = Logger.new(LOG_FILE) end
run(command, params: {}, outcodes: {})
click to toggle source
# File lib/unixoid/runner.rb, line 14 def self.run(command, params: {}, outcodes: {}) new.run(command, params: params, outcodes: outcodes) end
Public Instance Methods
log(level, message)
click to toggle source
# File lib/unixoid/runner.rb, line 27 def log(level, message) @logger.send(level, message) message end
run(command, params: {}, outcodes: [0])
click to toggle source
# File lib/unixoid/runner.rb, line 18 def run(command, params: {}, outcodes: [0]) line = Cocaine::CommandLine.new('', command, expected_outcodes: outcodes, swallow_stderr: true) begin log(:info, line.run(params)) rescue Cocaine::ExitStatusError => error log(:error, error.message) end end