The i2c library that I am using (kelly/node-i2c) works great...but...after some period of observations it causes node.js to fail with a segmentation fault. I am not sure this is a problem with the base library or with how I am using it with the Analog Digital Converter that I am using. I suspect that it is the latter but I don't have the technical skills to diagnose the problem. Given the former I decided to implement a workaround as described below.
Since failures generally only occurred after a period of time I decided to create a background process that could be started for the period of observation and then killed until the next period is started.
I am using an event to start the observation period by sending a message to the wireServer process started above. The message tells the server where to look for the I2c device. Once this is done I setup a handler for readings coming back from the server.
Once the I2c interface is started node will no longer respond to messages sent to the background process! This means I have no way of asking it to die gracefully. That being missing I use a little less graceful approach and kill it at the O/S level.
Finally we launch the observation perio.
The background process that the above launches, and then communicates with, is shown below: