Sha256: 5ed2ac258076c6690762416a1cd1da350ea7d4a10c1883d3548a99cd1fafbc33
Contents?: true
Size: 915 Bytes
Versions: 7
Compression:
Stored size: 915 Bytes
Contents
require 'pty' 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 class << self # Spawns 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) if block_given? ::PTY.spawn(*args) do |reader, writer, pid| begin yield(reader, writer, pid) rescue Errno::EIO ensure ::Process.wait(pid) end end else reader, writer, pid = ::PTY.spawn(*args) end [reader, writer, pid] end end end end
Version data entries
7 entries across 7 versions & 1 rubygems
Version | Path |
---|---|
ztk-1.4.11 | lib/ztk/pty.rb |
ztk-1.4.10 | lib/ztk/pty.rb |
ztk-1.4.9 | lib/ztk/pty.rb |
ztk-1.4.8 | lib/ztk/pty.rb |
ztk-1.4.7 | lib/ztk/pty.rb |
ztk-1.4.6 | lib/ztk/pty.rb |
ztk-1.4.5 | lib/ztk/pty.rb |