fixed the merge before doom

This commit is contained in:
QuiteAFancyEmerald 2024-08-08 17:28:40 -07:00
parent b39c06d956
commit 40e9cd8d60
No known key found for this signature in database
GPG key ID: 2C9730062CD48870

View file

@ -56,14 +56,14 @@ commands: for (let i = 2; i < process.argv.length; i++)
// because exiting this program will also terminate backend.js on Windows.
else {
const server = fork(
fileURLToPath(new URL("./backend.js", import.meta.url)),
fileURLToPath(new URL('./backend.js', import.meta.url)),
{
cwd: process.cwd(),
stdio: ["inherit", "inherit", "pipe", "ipc"],
detached: true
stdio: ['inherit', 'inherit', 'pipe', 'ipc'],
detached: true,
}
);
server.stderr.on("data", stderr => {
server.stderr.on('data', (stderr) => {
console.error(stderr.toString());
process.exitCode = 1;
});
@ -74,9 +74,10 @@ commands: for (let i = 2; i < process.argv.length; i++)
// Stop the server. Make a temporary file that the server will check for if told
// to shut down. This is done by sending a GET request to the server.
case "stop": {
await writeFile(shutdown, "");
let timeoutId, hasErrored = false;
case 'stop': {
await writeFile(shutdown, '');
let timeoutId,
hasErrored = false;
try {
// Give the server 5 seconds to respond, otherwise cancel this and throw an
// error to the console. The fetch request will also throw an error immediately
@ -100,13 +101,12 @@ commands: for (let i = 2; i < process.argv.length; i++)
else {
console.error(e);
// Stop here unless Node will be killed later.
if (!process.argv.slice(i + 1).includes("kill"))
hasErrored = true;
if (!process.argv.slice(i + 1).includes('kill')) hasErrored = true;
}
}
// Do not run this if Node will be killed later in this script. It will fail.
if (config.production && !process.argv.slice(i + 1).includes("kill"))
exec("npx pm2 stop ecosystem.config.js", (error, stdout) => {
if (config.production && !process.argv.slice(i + 1).includes('kill'))
exec('npx pm2 stop ecosystem.config.js', (error, stdout) => {
if (error) {
console.error(error);
hasErrored = true;
@ -165,5 +165,4 @@ commands: for (let i = 2; i < process.argv.length; i++)
// No default case.
}
process.exitCode = process.exitCode || 0;