github/hubot — pull request #676 by aaronstaves (2014-04-01 04:45:33+00:00)
Title: Create function emitError to reference when removing events

#### Pull Request Summary
Looks like instantiating a new Robot will attach an 'uncaughtException' handler to the main process object using an anonymous function. This listener is never cleaned up, even when shutdown is explicitly called. I've added a function emitError that can be referenced when removing the event listener.

#### Issue
The issue is that when a robot is created and shut down multiple times (my use case is unit tests, but there may be others) the event listener for 'uncaughtException' is never removed. I'll specifically receive a warning in this when running my unit tests, you can see that in the travis-ci link below. Feel free to use my plugin to reproduce.

#### Links
Unit Tests with warning - https://travis-ci.org/aaronstaves/hubot-substitute/jobs/21996378.
Github Plugin - https://github.com/aaronstaves/hubot-substitute
NPM Plugin - https://www.npmjs.org/package/hubot-substitute