From 65f0a87972cc8c425080ea45af93c4927887c13c Mon Sep 17 00:00:00 2001 From: Muthu Kumar Date: Fri, 3 Nov 2017 13:46:41 +0530 Subject: [PATCH] Changed exec to execSync; moved error console messages to only output when errs --- util/nginxReload.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/util/nginxReload.js b/util/nginxReload.js index e4ad7a1..a0e86b9 100644 --- a/util/nginxReload.js +++ b/util/nginxReload.js @@ -1,14 +1,14 @@ -var { exec } = require('child_process'); +var { execSync } = require('child_process'); function nginxReload() { - exec('service nginx reload', (error, stdout, stderr) => { - if (error) { + execSync('service nginx reload', function (error, stdout, stderr) { + if (error) { console.error(`exec error: ${error}`); + console.log(`stdout: ${stdout}`); + console.log(`stderr: ${stderr}`); return; - } - console.log(`stdout: ${stdout}`); - console.log(`stderr: ${stderr}`); - }); + } + }) } module.exports = nginxReload; \ No newline at end of file