jperkin / node-rpio

Raspberry Pi GPIO library for node.js
857 stars 123 forks source link

Way to prevent hook of 'exit' and automatically calling rpio_close #118

Closed chriskinsman closed 4 years ago

chriskinsman commented 4 years ago

I have a library I am working on that hooks:

process.on("exit", () => this.cleanup());

In cleanup it does some rpio access to clean up a device.

The problem is that rpio also hooks process.on('exit') and closes down all the setup pins. When I try to access them I get a segmentation fault as they have already been closed down.

Is there a way to prevent the hooking of the process exit signal and instead put the burden on me to call rpio_close?

I didn't see one in the code.

Thanks!

119

chriskinsman commented 4 years ago

I have submitted pull request #119 to provide a way to do this if @jperkin could take a look.