possible coolify fix
This commit is contained in:
parent
a4991d950f
commit
ab291c6c66
@ -7,12 +7,17 @@ class CommandManager {
|
|||||||
private commands: Map<string, Function> = new Map();
|
private commands: Map<string, Function> = new Map();
|
||||||
private rl: readline.Interface;
|
private rl: readline.Interface;
|
||||||
private io: Server | null = null;
|
private io: Server | null = null;
|
||||||
|
private rlClosed: boolean = false;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.rl = readline.createInterface({
|
this.rl = readline.createInterface({
|
||||||
input: process.stdin,
|
input: process.stdin,
|
||||||
output: process.stdout
|
output: process.stdout
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.rl.on('close', () => {
|
||||||
|
this.rlClosed = true;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public async boot(io: Server) {
|
public async boot(io: Server) {
|
||||||
@ -23,6 +28,8 @@ class CommandManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private startPrompt() {
|
private startPrompt() {
|
||||||
|
if (this.rlClosed) return;
|
||||||
|
|
||||||
this.rl.question('> ', (command: string) => {
|
this.rl.question('> ', (command: string) => {
|
||||||
this.processCommand(command);
|
this.processCommand(command);
|
||||||
this.startPrompt();
|
this.startPrompt();
|
||||||
@ -43,7 +50,6 @@ class CommandManager {
|
|||||||
case 'exit':
|
case 'exit':
|
||||||
console.log('Goodbye!');
|
console.log('Goodbye!');
|
||||||
this.rl.close();
|
this.rl.close();
|
||||||
process.exit(0);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
console.error(`Unknown command: ${command}`);
|
console.error(`Unknown command: ${command}`);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user