Simplify runWith return

This commit is contained in:
1computer1 2019-03-15 22:13:38 -04:00
parent 17e5eade08
commit 5568441526
6 changed files with 10 additions and 10 deletions

View file

@ -12,10 +12,10 @@ class CSharp extends Language {
runWith(options) { runWith(options) {
if (options.has('e')) { if (options.has('e')) {
return { id: this.id, env: { EVAL_EXPR: 'true' } }; return { env: { EVAL_EXPR: 'true' } };
} }
return super.runWith(options); return {};
} }
} }

View file

@ -12,10 +12,10 @@ class Haskell extends Language {
runWith(options) { runWith(options) {
if (options.has('e')) { if (options.has('e')) {
return { id: this.id, env: { EVAL_EXPR: 'true' } }; return { env: { EVAL_EXPR: 'true' } };
} }
return super.runWith(options); return {};
} }
} }

View file

@ -12,10 +12,10 @@ class Julia extends Language {
runWith(options) { runWith(options) {
if (options.has('e')) { if (options.has('e')) {
return { id: this.id, env: { EVAL_EXPR: 'true' } }; return { env: { EVAL_EXPR: 'true' } };
} }
return super.runWith(options); return {};
} }
} }

View file

@ -13,10 +13,10 @@ class Python extends Language {
runWith(options) { runWith(options) {
if (options.has('2')) { if (options.has('2')) {
return { id: 'python2', env: {} }; return { id: 'python2' };
} }
return { id: 'python3', env: {} }; return { id: 'python3' };
} }
} }

View file

@ -15,7 +15,7 @@ class Language extends AkairoModule {
} }
runWith() { runWith() {
return { id: this.id, env: {} }; return {};
} }
} }

View file

@ -62,7 +62,7 @@ class LanguageHandler extends AkairoHandler {
evalCode(message, { language, code, options }) { evalCode(message, { language, code, options }) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const name = `comp_iler-${message.id}-${Date.now()}`; const name = `comp_iler-${message.id}-${Date.now()}`;
const { id, env } = language.runWith(options); const { id = language.id, env = {} } = language.runWith(options);
const proc = childProcess.spawn('docker', [ const proc = childProcess.spawn('docker', [
'run', '--rm', `--name=${name}`, '-u1000', '-w/tmp/', 'run', '--rm', `--name=${name}`, '-u1000', '-w/tmp/',
'--net=none', `--cpus=${this.client.config.cpus}`, `-m=${this.client.config.memory}`, '--net=none', `--cpus=${this.client.config.cpus}`, `-m=${this.client.config.memory}`,