From 406e88d04105a60109fc68b0d0ef1d9e62fc1fd7 Mon Sep 17 00:00:00 2001 From: Kacarott <keldan.chapman@gmail.com> Date: Thu, 3 Sep 2020 07:57:10 +0200 Subject: [PATCH] Can cooperate with Terminus (allows inputs) --- lib/runtime.js | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/lib/runtime.js b/lib/runtime.js index 01e2ea3b..a0236035 100644 --- a/lib/runtime.js +++ b/lib/runtime.js @@ -49,8 +49,6 @@ export default class Runtime { // * "File Based" // input (Optional) - {String} that'll be provided to the `stdin` of the new process execute(argType = 'Selection Based', input = null, options = null) { - if (atom.config.get('script.stopOnRerun')) this.stop(); - this.emitter.emit('start'); const codeContext = this.codeContextBuilder.buildCodeContext( atom.workspace.getActiveTextEditor(), argType); @@ -62,6 +60,26 @@ export default class Runtime { const executionOptions = !options ? this.scriptOptions : options; const commandContext = CommandContext.build(this, executionOptions, codeContext); + + // Will cooperate with Terminus to allow for inputs, if user has installed. + try { + var terminus = require('../../terminus/lib/terminus.js').provideTerminus(); + } catch (e) { + var terminus = null; + console.log("Could not find Terminus"); + } + if (terminus != null) { + var command = commandContext.command; + for (let i = 0; i < commandContext.args.length; i++) { + command += ' "' + commandContext.args[i] + '"'; + } + terminus.run(['printf "\\33c\\e[3J" && ' + command]); + return; + } + + if (atom.config.get('script.stopOnRerun')) this.stop(); + this.emitter.emit('start'); + if (!commandContext) return; if (commandContext.workingDirectory) {