Method: ShopifyCLI::Context#on_siginfo
- Defined in:
- lib/shopify_cli/context.rb
#on_siginfo ⇒ Object
captures the info signal (ctrl-T) and provide a handler to it.
#### Example
@ctx.on_siginfo do
@ctx.open_url!("http://google.com")
end
570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 |
# File 'lib/shopify_cli/context.rb', line 570 def on_siginfo # Reset any previous SIGINFO handling we had so the only action we take is the given block trap("INFO", "DEFAULT") fork do r, w = IO.pipe @signal = false trap("SIGINFO") do @signal = true w.write(0) end while r.read(1) next unless @signal @signal = false yield end rescue Interrupt exit(0) end end |