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