From c44eb3af266ce8ace6d2eafac407082bfcec790b Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 1 Dec 2020 16:01:44 +0100 Subject: [PATCH] better string check --- apps/remix-ide/src/app/panels/terminal.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/remix-ide/src/app/panels/terminal.js b/apps/remix-ide/src/app/panels/terminal.js index 3a997ba40b..6e1779a78c 100644 --- a/apps/remix-ide/src/app/panels/terminal.js +++ b/apps/remix-ide/src/app/panels/terminal.js @@ -485,7 +485,8 @@ class Terminal extends Plugin { return self._view.el function wrapScript (script) { - if (script.trim().startsWith('remix.') || script.trim().startsWith('git')) return script + const isKnownScript = ['remix.', 'git'].some(prefix => script.trim().startWith(prefix)) + if (isKnownScript) return script return ` try { const ret = ${script}; @@ -746,7 +747,7 @@ class Terminal extends Plugin { } } try { - if (script.trim().indexOf('git') === 0) { + if (script.trim().startWith('git')) { const result = await this.call('git', 'command', script) self.commands.html(yo`
${result}
`) } else {