Skip to content

Commit

Permalink
fix: headless process not exiting
Browse files Browse the repository at this point in the history
  • Loading branch information
Julusian committed Jan 23, 2021
1 parent 2dde1ce commit 3821983
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"electron-store": "^6.0.1",
"elgato-stream-deck": "^4.0.1",
"eventemitter3": "^4.0.7",
"exit-hook": "^2.2.0",
"meow": "^9.0.0",
"sharp": "^0.27.0",
"usb-detection": "^4.10.0"
Expand All @@ -76,8 +77,8 @@
"output": "electron-output/"
},
"mac": {
"category": "dev.julusian.companion.remote",
"target": "dmg",
"category": "dev.julusian.companion.remote",
"target": "dmg",
"extendInfo": {
"LSBackgroundOnly": 1,
"LSUIElement": 1
Expand Down
7 changes: 7 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import exitHook = require('exit-hook')
import * as meow from 'meow'
import { CompanionSatelliteClient } from './client'
import { DeviceManager } from './devices'
Expand Down Expand Up @@ -25,6 +26,12 @@ const devices = new DeviceManager(client)
client.on('log', (l) => console.log(l))
client.on('error', (e) => console.error(e))

exitHook(() => {
console.log('Exiting')
client.disconnect()
devices.close()
})

client.connect(cli.input[0])

devices

0 comments on commit 3821983

Please sign in to comment.