0.0
No commit activity in last 3 years
No release in over 3 years
Execute external command and retrive STDIN/STDOUT in real time.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

RuntimeCommand

Gem Version Test Coverage Code Climate CircleCI

Description

Execute external command and retrive STDIN/STDOUT in real time.

Installation

Add this line to your application's Gemfile:

gem 'runtime_command'

And then execute:

$ bundle

Or install it yourself as:

$ gem install runtime_command

Usage

command execution

require 'runtime_command'

command = RuntimeCommand::Builder.new
command.exec('echo wait; sleep 3; echo hello')

Write command result to file

logger = Logger.new('result.log')
command = RuntimeCommand::Builder.new(logger: logger)
command.exec('whoami')

Retrive result

logger = command.exec('whoami', output: false)

puts logger.buffered_stdout
puts logger.buffered_stderr

Change output color

colors = { stdout: HighLine::Style.rgb(255, 0, 0) }
command = RuntimeCommand::Builder.new(colors: colors)
logger = command.exec('whoami')