possible coolify fix

This commit is contained in:
Dennis Postma 2024-06-05 00:30:41 +02:00
parent a4991d950f
commit ab291c6c66

View File

@ -7,12 +7,17 @@ class CommandManager {
private commands: Map<string, Function> = new Map();
private rl: readline.Interface;
private io: Server | null = null;
private rlClosed: boolean = false;
constructor() {
this.rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
this.rl.on('close', () => {
this.rlClosed = true;
});
}
public async boot(io: Server) {
@ -23,6 +28,8 @@ class CommandManager {
}
private startPrompt() {
if (this.rlClosed) return;
this.rl.question('> ', (command: string) => {
this.processCommand(command);
this.startPrompt();
@ -43,7 +50,6 @@ class CommandManager {
case 'exit':
console.log('Goodbye!');
this.rl.close();
process.exit(0);
break;
default:
console.error(`Unknown command: ${command}`);