linux-device
Advanced tools
Comparing version 2.0.7 to 2.0.8
@@ -75,2 +75,3 @@ "use strict"; | ||
if(this.fd) await this.close().catch(()=>{}); | ||
if(this[kSource].tainted) throw new Error('attempt to reuse closed DeviceHandle'); | ||
const res = await this[kSource].handle.open(this[kSource].mode | CONSTANTS.O_DSYNC); | ||
@@ -90,6 +91,9 @@ this.fd = res; | ||
if(!this.fd) return; | ||
delete this.fd; | ||
if(this[kSource].readable) { | ||
this.push(null); | ||
this[kSource].tainted = true; | ||
} | ||
await this[kSource].handle.close(); | ||
this.push(null); | ||
this.emit('close'); | ||
delete this.fd; | ||
} | ||
@@ -197,2 +201,4 @@ | ||
if(!this.fd) return; | ||
if(err) { | ||
@@ -237,2 +243,2 @@ return process.nextTick(() => { | ||
module.exports = DeviceHandle; | ||
module.exports = DeviceHandle; |
{ | ||
"name": "linux-device", | ||
"version": "2.0.7", | ||
"version": "2.0.8", | ||
"description": "Native addon to communicate with linux devices (can also be used for sockets or FIFOs)", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
1103052
1074