Module: SafePty

Defined in:
lib/ansible/safe_pty.rb

Class Method Summary collapse

Class Method Details

.spawn(command, &block) ⇒ Object



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

def self.spawn command, &block

  PTY.spawn(command) do |r,w,p|
    begin
      yield r,w,p
    rescue Errno::EIO
      # ignore Errno::EIO: Input/output error @ io_fillbuf
    ensure
      Process.wait p
    end
  end

  $?.exitstatus
end