2018-03-04 15:09:18 -08:00
|
|
|
import Interrupt from '../src/interrupt'
|
2018-07-01 15:37:59 -07:00
|
|
|
// import Base from '@uci/base'
|
2018-03-04 15:09:18 -08:00
|
|
|
|
|
|
|
// let interrupt = new Interrupt(24,{id:'test-interrupt', wait:0})
|
|
|
|
// let listener = new Base({sockets:'inter#s>n', inter:{path:'interrupt:24'}, id:'listener'})
|
|
|
|
|
2018-07-01 15:37:59 -07:00
|
|
|
let interrupt = new Interrupt(24,{id:'test-interrupt', wait:0, hook:true, mock:true,useRootNS:true})
|
|
|
|
// let processor = new Base({sockets:'inter#c>t', inter:{port:9024}, id:'listener'})
|
2018-03-04 15:09:18 -08:00
|
|
|
|
|
|
|
|
2018-07-01 15:37:59 -07:00
|
|
|
// processor.interrupt = async function (packet) {
|
|
|
|
// return new Promise((resolve) => {
|
|
|
|
// console.log('interrupt socket listener got')
|
|
|
|
// console.dir(packet)
|
|
|
|
// resolve({status: 'processed'})
|
|
|
|
// })
|
|
|
|
//
|
|
|
|
// }
|
2018-03-04 15:09:18 -08:00
|
|
|
|
|
|
|
;
|
|
|
|
(async () => {
|
|
|
|
|
2018-07-01 15:37:59 -07:00
|
|
|
await interrupt.init()
|
|
|
|
console.log('interrupt ready and waiting')
|
|
|
|
// console.log((await processor.init())[0].err.opts)
|
|
|
|
// interrupt.fire()
|
|
|
|
// processor.send({cmd: 'fire'})
|
2018-03-04 15:09:18 -08:00
|
|
|
// interrupt.fire()
|
|
|
|
// interrupt.fire()
|
|
|
|
// interrupt.fire()
|
|
|
|
// await delay(3000)
|
|
|
|
// process.kill(process.pid, 'SIGTERM')
|
|
|
|
|
|
|
|
})().catch(err => {
|
|
|
|
console.error('FATAL: UNABLE TO START SYSTEM!\n',err)
|
|
|
|
// process.kill(process.pid, 'SIGTERM')
|
|
|
|
})
|