update close dev

This commit is contained in:
Jay 2017-08-16 22:24:04 +08:00
parent 49037058b4
commit 1df34c0946

View File

@ -74,8 +74,14 @@ function printString(str){
printer.cut(true, 8)
}
process.on('SIGINT', ()=>{
device.close()
process.on('SIGINT', async ()=>{
await new Promise((resolve, reject) => {
device.close(()=>{
console.log('serial device close')
resolve(null)
})
})
process.exit(0)
})
module.exports = DataCharacteristic