module Ansible::SafePty

Wrapper for PTY pseudo-terminal

Public Class Methods

spawn(command) { |r,w,p| ... } click to toggle source

Spawns process for command @param command [String] command @return [Integer] exit status

# File lib/ansible/safe_pty.rb, line 8
def self.spawn(command)

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

  $?.exitstatus
end