From 9c0ca37481ba39b0ef0f9e734d0ceeac92dfa49f Mon Sep 17 00:00:00 2001 From: mmcwilliams Date: Thu, 8 Feb 2018 15:50:21 -0500 Subject: [PATCH] End response and call next() before restarting process. --- index.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 07c0d2c..7070ed5 100644 --- a/index.js +++ b/index.js @@ -348,14 +348,20 @@ function rUpdate (req, res, next) { exec('sh ./scripts/update.sh', (err, stdio, stderr) => { res.send({ success : true, action : 'update' }) res.end() - process.exit(0) + next() + setTimeout(() => { + process.exit(0) + }, 100) }) } function rRestart (req, res, next) { res.send({ success : true, action : 'restart' }) res.end() - process.exit(0) + next() + setTimeout(() => { + process.exit(0) + }, 100) } //Ble functions