From 55684415266b23e86458c4478985ba7d2a2b337f Mon Sep 17 00:00:00 2001 From: 1computer1 Date: Fri, 15 Mar 2019 22:13:38 -0400 Subject: [PATCH] Simplify runWith return --- src/languages/csharp.js | 4 ++-- src/languages/haskell.js | 4 ++-- src/languages/julia.js | 4 ++-- src/languages/python.js | 4 ++-- src/struct/Language.js | 2 +- src/struct/LanguageHandler.js | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/languages/csharp.js b/src/languages/csharp.js index 9b27342..070e245 100644 --- a/src/languages/csharp.js +++ b/src/languages/csharp.js @@ -12,10 +12,10 @@ class CSharp extends Language { runWith(options) { if (options.has('e')) { - return { id: this.id, env: { EVAL_EXPR: 'true' } }; + return { env: { EVAL_EXPR: 'true' } }; } - return super.runWith(options); + return {}; } } diff --git a/src/languages/haskell.js b/src/languages/haskell.js index ceeb7e3..7e86266 100644 --- a/src/languages/haskell.js +++ b/src/languages/haskell.js @@ -12,10 +12,10 @@ class Haskell extends Language { runWith(options) { if (options.has('e')) { - return { id: this.id, env: { EVAL_EXPR: 'true' } }; + return { env: { EVAL_EXPR: 'true' } }; } - return super.runWith(options); + return {}; } } diff --git a/src/languages/julia.js b/src/languages/julia.js index fc26a1d..09b6e27 100644 --- a/src/languages/julia.js +++ b/src/languages/julia.js @@ -12,10 +12,10 @@ class Julia extends Language { runWith(options) { if (options.has('e')) { - return { id: this.id, env: { EVAL_EXPR: 'true' } }; + return { env: { EVAL_EXPR: 'true' } }; } - return super.runWith(options); + return {}; } } diff --git a/src/languages/python.js b/src/languages/python.js index cb68687..d2d91f2 100644 --- a/src/languages/python.js +++ b/src/languages/python.js @@ -13,10 +13,10 @@ class Python extends Language { runWith(options) { if (options.has('2')) { - return { id: 'python2', env: {} }; + return { id: 'python2' }; } - return { id: 'python3', env: {} }; + return { id: 'python3' }; } } diff --git a/src/struct/Language.js b/src/struct/Language.js index 760d403..f3b1441 100644 --- a/src/struct/Language.js +++ b/src/struct/Language.js @@ -15,7 +15,7 @@ class Language extends AkairoModule { } runWith() { - return { id: this.id, env: {} }; + return {}; } } diff --git a/src/struct/LanguageHandler.js b/src/struct/LanguageHandler.js index 411f2a5..c8d70a9 100644 --- a/src/struct/LanguageHandler.js +++ b/src/struct/LanguageHandler.js @@ -62,7 +62,7 @@ class LanguageHandler extends AkairoHandler { evalCode(message, { language, code, options }) { return new Promise((resolve, reject) => { 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', [ 'run', '--rm', `--name=${name}`, '-u1000', '-w/tmp/', '--net=none', `--cpus=${this.client.config.cpus}`, `-m=${this.client.config.memory}`,