Sha256: 4090c30f4e09b4a0607439328d0c28319326f11451202077df27efc6e2475a0d
Contents?: true
Size: 892 Bytes
Versions: 92
Compression:
Stored size: 892 Bytes
Contents
module ZTK # PTY Error Class # # @author Zachary Patten <zachary AT jovelabs DOT com> class PTYError < Error; end # Ruby PTY Class Wrapper # # Wraps the Ruby PTY class, providing better functionality. # # @author Zachary Patten <zachary AT jovelabs DOT com> class PTY require 'pty' class << self # Execute a process via a ruby-based PTY. # # @param [Array] args An argument splat to be passed to PTY::spawn # # @return [Object] Returns the $? object. def spawn(*args, &block) begin ::PTY.spawn(*args) do |reader, writer, pid| begin block_given? and yield(reader, writer, pid) rescue Errno::EIO ensure ::Process.wait(pid) end end rescue ::PTY::ChildExited end true end end end end
Version data entries
92 entries across 92 versions & 1 rubygems