Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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