Class: Ruboty::Handlers::Evaluate
- Inherits:
-
Base
- Object
- Base
- Ruboty::Handlers::Evaluate
- Defined in:
- lib/ruboty/handlers/evaluate.rb
Instance Method Summary collapse
Instance Method Details
#evaluate(message) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/ruboty/handlers/evaluate.rb', line 8 def evaluate() thread = Thread.start do stdout, stderr, status = Open3.capture3([:command]) .reply(stdout.chomp) if stdout .reply(stderr.chomp) if stderr unless status.success? .reply("Command Failed:\n#{message[:command]}", code: true) end end Thread.start do sleep 10 thread.kill end end |