Skip to content

Commit

Permalink
fix #86
Browse files Browse the repository at this point in the history
  • Loading branch information
oznu committed Apr 21, 2018
1 parent 939c23c commit cbee67b
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

All notable changes to this project will be documented in this file. This project uses [Semantic Versioning](https://semver.org/).

## 3.5.5 (2018-04-21)

### Bug Fixes

* Ensure forked process is killed if Homebridge is not running in a different way (@Damien via Slack & [#86](https://github.com/oznu/homebridge-config-ui-x/issues/86))

## 3.5.4 (2018-04-19)

### Notable Changes
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "homebridge-config-ui-x",
"version": "3.5.4",
"version": "3.5.5",
"description": "Configuration UI plugin for Homebridge",
"license": "MIT",
"keywords": [
Expand Down
10 changes: 5 additions & 5 deletions src/bin/fork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ import 'source-map-support/register';

import { UiServer } from '../server';

let healthcheck;
setInterval(() => {
if (!process.connected) {
process.exit(1);
}
}, 10000);

process.on('message', (message) => {
if (typeof message === 'object') {
return new UiServer(message);
} else if (message === 'ping') {
clearTimeout(healthcheck);
healthcheck = setTimeout(process.exit, 30000);
}
});

process.on('disconnect', () => {
console.warn('Parent process terminated, shutting down homebridge-config-ui-x...');
process.exit();
});

Expand Down
5 changes: 1 addition & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ class HomebridgeConfigUi {

ui.on('message', (message) => {
if (message === 'ready') {
ui.send('ping');
ui.send(setup);
}
});
Expand All @@ -56,9 +55,7 @@ class HomebridgeConfigUi {
process.exit(1);
});

setInterval(() => {
ui.send('ping');
}, 15000);
ui.on('error', (err) => {});
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class UiServer {
onServerListening() {
const addr = this.server.address();
const bind = typeof addr === 'string' ? 'pipe ' + addr : 'port ' + addr.port;
const msg = 'Console is listening on ' + bind + '.';
const msg = `Console v${hb.ui.version} is listening on ${bind}.`;
hb.log(msg);
}

Expand Down

0 comments on commit cbee67b

Please sign in to comment.