Headless should call headless.destroy in an ensure block within the run method so that it still cleans up if the yielded code raises an exception. Headless could also register an at_exit hook when a new Headless instance is instantiated to cleanup the process if it is still running when the Ruby process exits. Right now it's very easy for the Headless gem to leave Xvfb running.
Yep, that is reasonable. Thanks for mentioning.
this has been addressed in v0.2.1.
Xvfb is now automatically stopped at exit unless you pass a special option to the constructor.