Socket
Book a DemoInstallSign in
Socket

mind_control

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mind_control

0.4.0
bundlerRubygems
Version published
Maintainers
1
Created
Source

Mind Control

Embeddable runtime Pry-based REPL console for long-running programs.

Features:

  • Executes code without interruption of the host program;
  • Full fledged Pry console with code highlighting and completion;
  • Allows multiple connections;
  • EventMachine integration;
  • Has very few dependencies (no DRb or EventMachine);

Installation

Add this line to your application's Gemfile:

gem "mind_control"

Requirements

  • Ruby 1.9+;
  • *NIX operating system (UNIX sockets is required);

Usage

To start console server:

require "mind_control"
MindControl.start

You can also set Pry target (something.pry):

...
MindControl.start :target => something

Or Pry options:

...
MindControl.start :pry => { .. options for pry instance .. }

Or set program name (see "Connection"):

...
MindControl.start :name => "some name"

NB: HOME (or XDG_CACHE_HOME) environment variable MUST be set for host program!

Connection

Run in terminal:

$ bundle exec mind_control

You will be prompted with a list of currently running MindControlled processes.

Or, if you already know name or PID of process:

$ bundle exec mind_control name_or_pid

Capture output

You can capture STDOUT/STDERR of host program. To do that execute capture-output in REPL.

[1] pry(main)> capture-output --help

Usage: capture_output [ --no-stdout | --no-stderr ] [ -f, --filter <regexp> ]

Captures host program STDOUT and STDERR and prints it to user.

        --no-stdout      Do not capture STDOUT.
        --no-stderr      Do not capture STDERR.
    -f, --filter         Filter output with given regular expression.
    -h, --help           Show this message.

EventMachine

MindControl can be used with EventMachine. Just require file and set EventMachine as target and all commands will be evaluated in the context of running reactor.

require "mind_control"
require "mind_control/em"

MindControl.start :target => EventMachine

Capistrano task

You can use capistrano to start SSH session:

task :mind_control, :roles => :app do
  server = find_servers_for_task( current_task ).first

  exec <<-SH
    ssh #{server.user || user}@#{server.host} -p #{server.port || 22} -t "#{rvm_shell} -c 'cd #{current_path} && bundle exec mind_control'"
  SH
end

TODO

  • Better readme;
  • Tests;
  • Get rid of Engrish;

FAQs

Package last updated on 26 Jul 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.