Initial commit

This commit is contained in:
Maki
2026-01-04 18:00:24 +08:00
commit a081f51cc6
42 changed files with 2962 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
import proc, { exec, execSync } from 'child_process'
import { ConsoleCommandData } from '../types/Command';
import { server } from '..';
import { db } from '../util/database';
export const metadata: ConsoleCommandData = {
name: 'restart',
description: "Restarts the application.",
usage: false,
aliases: ["re", "reboot"]
}
export function run(command: string) {
try {
execSync(command, { stdio: 'inherit' })
} catch (err) {
//c.error(`Caught exception while rebuilding the project. E:\n${err}`)
process.exit(0) // probably a sigint?
}
}
export function Main(args: Array<string>): string {
try {
server.close();
db.close();
} catch { } // if this fails then the server and db are probably closed already
run("npm run quick");
return "The new process has crashed. Run \"restart\" to rebuild the application again."
}