Skip to content

Commit

Permalink
platform: Fix declare cleanup before calling it (#96)
Browse files Browse the repository at this point in the history
Change-Id: Ic1342ccd8cc105db4ac9fbdccf35910df4d4013d
Signed-off-by: Philippe Coval <p.coval@samsung.com>
  • Loading branch information
rzr authored and mrstegeman committed Jun 26, 2019
1 parent 3911610 commit 448e5f2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions example/platform/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,16 @@ Try:\ncurl -H "Accept: application/json" ${url}\
const thing = new BoardThing();
const server = new WebThingServer(new SingleThing(thing), port);
process.on('SIGINT', () => {
server.stop().then(cleanup).catch(cleanup);
const cleanup = () => {
thing && thing.close();
log(`log: board: ${board}: Stopped`);
log(`log: board: ${board}: Exit`);
process.exit();
};
server.stop().then(cleanup).catch(cleanup);
});
server.start().catch(console.error);
log(`log: board: ${board}: Started`);
}

runServer();

0 comments on commit 448e5f2

Please sign in to comment.