Skip to content

Latest commit

 

History

History
26 lines (17 loc) · 651 Bytes

README.md

File metadata and controls

26 lines (17 loc) · 651 Bytes

Signals

Example of hot reloading a Ruby class from another process.

This application just calls Player.new.run in a loop, whose default behavior is to print out the current process ID. However, it also listens for the SIGUSR2 signal and will reload the Player class when it's received.

Start looping:

ruby runner.rb

Now edit the #run method in player.rb and save it. Afterwards, tell the original process to pick up the change:

kill -s SIGUSR2 <PID>

Try it out!

Just clone it and cd to the signals directory

git clone git@github.com:ridiculous/signals.git