Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
pm2.connect((error) => {
if (error) {
console.log(chalk.bgRed(error.message))
process.exit(2)
}
pm2.stop(pid, (error, apps) => {
pm2.disconnect()
if (error) {
console.log(chalk.bgRed(error.message))
process.exit(2)
}
this.getProcessStatus(() => {
if (callback instanceof Function) callback()
})
})
})
}
pm2.connect(function (err) {
if (err) {
reject(err);
process.exit(2);
}
pm2.stop('gxb-box-pm2', function (err) {
if (err) {
reject(err);
} else {
pm2.describe('gxb-box-pm2', function (err, processDescription) {
if (err) {
reject(err);
} else {
resolve(processDescription);
}
});
}
});
});
});
server.stop = function(name, cb) {
pm2.stop(name, function (err, list) {
if(err) {
log.applog('error', 'pm2 List faild: ' + err);
}
return cb(err);
});
}
_.forEach(_ids, (_id) => pm2.stop(_id, () => {
}));
});
}, () => {
pm2.stop(APP_NAME, f.waitPlain());
}, () => {
pm2.start({
pm2.list((err, list) => {
onError(err);
const pList = list.filter(p => p.name === scriptName);
if(pList.length > 0) {
if(pList[0].pm2_env.status === 'online') {
pm2.stop(scriptName, err => {
onError(err);
pm2.start(scriptName, err => {
onError(err);
pm2.disconnect();
});
});
} else {
pm2.start(scriptName, err => {
onError(err);
pm2.disconnect();
});
}
function stop() {
pm2.stop('hubot', () => pm2.disconnect());
}
new Promise((resolve, reject) => {
stop(process, err => {
if (err && err.message !== 'process name not found') {
reject();
return;
}
resolve();
});
});
Runner.prototype.stop = function (options, next) {
var self = this;
self.bosco.log('Stopping ' + options.name.cyan);
pm2.stop(options.name, function (err) {
if (err) return next(err);
pm2.delete(options.name, function (err) {
next(err);
});
});
};
dialog.err(err, 'Error', () => {
pm2.stop('hubot', () => pm2.disconnect());
});
}