module ChildLabor

Public Class Methods

subprocess(cmd) { |t| ... } click to toggle source
# File lib/child_labor.rb, line 2
def self.subprocess(cmd)
  t = Task.new(cmd)
  t.launch

  if block_given?
    begin
      yield t
    ensure
      t.wait
      t.close
    end
  end

  return t
end