Module: Bizside::SafePty

Defined in:
lib/bizside/safe_pty.rb

Class Method Summary collapse

Class Method Details

.spawn(command, &block) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/bizside/safe_pty.rb', line 5

def self.spawn command, &block
  PTY.spawn(command) do |r, w, p|
    begin
      yield r, w, p
    rescue Errno::EIO
    ensure
      Process.wait p
    end
  end

  $?.exitstatus
end