From 32e297ee070c55c452b065de584aa304fd720a42 Mon Sep 17 00:00:00 2001 From: 1computer1 Date: Sat, 15 Jun 2019 23:35:20 -0400 Subject: [PATCH] Fix errors when setting up evals not being caught --- src/struct/LanguageHandler.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/struct/LanguageHandler.js b/src/struct/LanguageHandler.js index 9eeee3b..e1ec519 100644 --- a/src/struct/LanguageHandler.js +++ b/src/struct/LanguageHandler.js @@ -120,16 +120,16 @@ class LanguageHandler extends AkairoHandler { return evalQueue.enqueue(async () => { const { name } = await setupQueue.enqueue(() => this.setupContainer(dockerID)); const now = Date.now(); - await exec(`docker exec ${name} mkdir eval/${now}`); - await exec(`docker exec ${name} chmod 777 eval/${now}`); - const proc = childProcess.spawn('docker', [ - 'exec', '-u1001:1001', `-w/tmp/eval/${now}`, - ...Object.entries(env).map(([k, v]) => `-e${k}=${v}`), - name, '/bin/sh', '/var/run/run.sh', code - ]); - - const timeout = this.getCompilerConfig(dockerID, 'timeout', 'number'); try { + await exec(`docker exec ${name} mkdir eval/${now}`); + await exec(`docker exec ${name} chmod 777 eval/${now}`); + const proc = childProcess.spawn('docker', [ + 'exec', '-u1001:1001', `-w/tmp/eval/${now}`, + ...Object.entries(env).map(([k, v]) => `-e${k}=${v}`), + name, '/bin/sh', '/var/run/run.sh', code + ]); + + const timeout = this.getCompilerConfig(dockerID, 'timeout', 'number'); const result = await this.handleSpawn(proc, timeout); await exec(`docker exec ${name} rm -rf eval/${now}`); return result;