Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}, function(error, res) {
if (error) {
throw error;
}
pm2.flush(APP_NAME, (err) => {
if (err) {
throw err;
}
});
pm2.describe(0, (err, proc) => {
const logFile = proc[0].pm2_env.pm_out_log_path;
if (fs.existsSync(logFile)) {
fs.unlinkSync(logFile);
}
setTimeout(() => {
if (fs.existsSync(logFile)) {
log.info(fs.readFileSync(logFile, 'UTF-8'));
}
return new Promise((resolve, reject) => {
pm2.flush(procNameOrId, (err, processDescription) => {
if (err) {
disconnect()
reject(err)
} else {
disconnect()
resolve(processDescription)
}
})
})
}