0.0
No commit activity in last 3 years
No release in over 3 years
DEPRECATED - This gem has been replaced by process_builder
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

>= 0

Runtime

 Project Readme

ProcessBuilder¶ ↑

Simple object-oriented wrapper around Ruby’s Process.spawn and Open3 library.

ProcessBuilder allows you to build a process description which can then be used to spawn and interact with an external process.

Usage¶ ↑

require 'process_builder'

# Build a process description with the ProcessBuilder.build method.
process = ProcessBuilder.build('oggenc', 'track01.cdda.wav') do |builder|
  # The builder object passed to this block has methods for setting various
  # attributes of the process. See the RDoc for full details.
  builder.environment['LOG_DIR'] = '/var/log'
  builder.directory = "#{ENV['HOME']}/Music"
end

# Once the process description is built there are a variety of ways
# to spawn the process. One way is to call spawn:
pid = process.spawn
Process.wait(pid)

# Another way is to use any of the popen or capture methods defined by Open3:
stdin, stdout, stderr, wait_thread = process.popen3
status = wait_thread.value
stdin.close; stdout.close; stderr.close

# or in block form:
process.popen3 do |stdin, stdout, stderr, wait_thread|
  status = wait_thread.value
end