Module: ChildLabor

Defined in:
lib/child_labor.rb

Defined Under Namespace

Classes: Task

Class Method Summary collapse

Class Method Details

.subprocess(cmd) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# 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