Skip to content

Commit

Permalink
Can cooperate with Terminus (allows inputs)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kacarott authored and aminya committed Dec 29, 2020
1 parent cc13351 commit 406e88d
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions lib/runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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) {
Expand Down

0 comments on commit 406e88d

Please sign in to comment.