Class: Unixoid::Runner
- Inherits:
-
Object
- Object
- Unixoid::Runner
- Defined in:
- lib/unixoid/runner.rb
Constant Summary collapse
- LOG_FILE =
'logfile.log'
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Runner
constructor
A new instance of Runner.
- #log(level, message) ⇒ Object
- #run(command, outcodes: [0]) ⇒ Object
Constructor Details
Class Method Details
.run(command, opts = {}) ⇒ Object
14 15 16 |
# File 'lib/unixoid/runner.rb', line 14 def self.run(command, opts = {}) new.run(command, opts) end |
Instance Method Details
#log(level, message) ⇒ Object
27 28 29 30 |
# File 'lib/unixoid/runner.rb', line 27 def log(level, ) @logger.send(level, ) end |
#run(command, outcodes: [0]) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/unixoid/runner.rb', line 18 def run(command, outcodes: [0]) line = Cocaine::CommandLine.new(command, "", expected_outcodes: outcodes, swallow_stderr: true) begin log(:info, line.run) rescue Cocaine::ExitStatusError => error log(:error, error.) end end |