fix: delete sock files before nocobase start

This commit is contained in:
chenos 2024-04-18 14:25:05 +08:00
parent 651af7d741
commit 3445001540

View File

@ -1,9 +1,19 @@
const { Command } = require('commander');
const { isDev, run, postCheck, runInstall, promptForTs } = require('../util');
const { existsSync, unlink } = require('fs');
const { existsSync, rmSync } = require('fs');
const { resolve } = require('path');
const chalk = require('chalk');
function deleteSockFiles() {
const { SOCKET_PATH, PM2_HOME } = process.env;
if (existsSync(PM2_HOME)) {
rmSync(PM2_HOME, { recursive: true });
}
if (existsSync(SOCKET_PATH)) {
rmSync(SOCKET_PATH);
}
}
/**
*
* @param {Command} cli
@ -41,6 +51,7 @@ module.exports = (cli) => {
return;
}
await postCheck(opts);
deleteSockFiles();
if (opts.daemon) {
run('pm2', ['start', `${APP_PACKAGE_ROOT}/lib/index.js`, '--', ...process.argv.slice(2)]);
} else {