Class: Toro::CLI
- Inherits:
-
Object
- Object
- Toro::CLI
- Defined in:
- lib/toro/cli.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(arguments = ARGV) ⇒ CLI
constructor
A new instance of CLI.
- #run ⇒ Object
Constructor Details
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
3 4 5 |
# File 'lib/toro/cli.rb', line 3 def @options end |
Instance Method Details
#run ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/toro/cli.rb', line 10 def run Toro.logger.info 'Starting processing (press Control-C to stop)' read_io, write_io = IO.pipe %w(INT TERM USR1 USR2 TTIN).each do |signal| begin trap signal do write_io.puts(signal) end rescue ArgumentError Toro.logger.debug "Signal #{signal} not supported" end end begin @manager.start while readable_io = IO.select([read_io]) signal = readable_io.first[0].gets.strip handle_signal(signal) end rescue Interrupt Toro.logger.info 'Shutting down...' @manager.stop end # Explicitly exit so busy Processor threads can't block # process shutdown. exit 0 end |