Project

linedump

0.0
No commit activity in last 3 years
No release in over 3 years
linedump allows you to register blocks to consume live output streams, line by line.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.6
~> 2.11
~> 10.4
~> 3.1
~> 0.2
>= 1.6.1, ~> 1.6
 Project Readme

Linedump

Linedump provides a safe way of listening data from output streams. It's intended to be used to listen for child processes output.

Installation

Add this line to your application's Gemfile:

gem 'linedump'

And then execute:

$ bundle

Or install it yourself as:

$ gem install linedump

Usage

Usage is as simple as doing

stdin, stdout, wait_thr = Open3.popen('somebin')

Linedump.each_line stdout do |line|
  # this will be called in a separate listening thread.
  logger.log(line)
end

# do something with the process...

Contributing

  1. Fork it ( https://github.com/[my-github-username]/cangrejo/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request