Skip to content

Can cooperate with Atom Terminals (allows inputs) #2337

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Changes from 2 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
23 changes: 20 additions & 3 deletions lib/runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +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 +59,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();
Copy link
Member

@UziTech UziTech Jan 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should consume the terminusTerminal service to get the terminal.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for that matter there should be a standard terminal service that all terminals can provide to allow running in any terminal package.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have started creating PRs for terminal packages to provide the terminal service.

bus-stop/x-terminal#236
bus-stop/terminus#177
more to come...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you make a PR fixing this?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still in works? It doesn't seem to be implemented in the actual release

} catch (e) {
var terminus = null;
console.log('Could not find Terminus');
}
if (terminus != null) {
let 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