From 448e5f20ddac0ebc9c15688c15a5e4d155581216 Mon Sep 17 00:00:00 2001 From: Philippe Coval Date: Wed, 26 Jun 2019 19:32:22 +0200 Subject: [PATCH] platform: Fix declare cleanup before calling it (#96) Change-Id: Ic1342ccd8cc105db4ac9fbdccf35910df4d4013d Signed-off-by: Philippe Coval --- example/platform/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/example/platform/index.js b/example/platform/index.js index af91c41..2871d1a 100644 --- a/example/platform/index.js +++ b/example/platform/index.js @@ -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(); +