Add more logging

This commit is contained in:
1computer1 2019-05-20 20:41:41 -04:00
parent d25e0be634
commit d5b9be05d1
2 changed files with 8 additions and 4 deletions

View file

@ -9,8 +9,10 @@ class ExitCommand extends Command {
}); });
} }
async exec() { async exec(message) {
await message.util.send('Cleaning up...');
await this.client.languageHandler.cleanup(); await this.client.languageHandler.cleanup();
await message.util.send('Exiting!');
process.exit(); process.exit();
} }
} }

View file

@ -104,7 +104,7 @@ class LanguageHandler extends AkairoHandler {
await this.handleSpawn(proc); await this.handleSpawn(proc);
this.containers.set(dockerID, { name }); this.containers.set(dockerID, { name });
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.log(`Started container ${name} for 1computer1/comp_iler:${dockerID}.`); console.log(`Started container ${name}.`);
return this.containers.get(dockerID); return this.containers.get(dockerID);
} catch (err) { } catch (err) {
throw err; throw err;
@ -167,7 +167,7 @@ class LanguageHandler extends AkairoHandler {
}); });
} }
kill(name) { async kill(name) {
let cmd; let cmd;
if (process.platform === 'win32') { if (process.platform === 'win32') {
cmd = `docker kill --signal=9 ${name} >nul 2>nul`; cmd = `docker kill --signal=9 ${name} >nul 2>nul`;
@ -175,7 +175,9 @@ class LanguageHandler extends AkairoHandler {
cmd = `docker kill --signal=9 ${name} >/dev/null 2>/dev/null`; cmd = `docker kill --signal=9 ${name} >/dev/null 2>/dev/null`;
} }
return util.promisify(childProcess.exec)(cmd); await util.promisify(childProcess.exec)(cmd);
// eslint-disable-next-line no-console
console.log(`Killed container ${name}.`);
} }
cleanup() { cleanup() {