Class: ZTK::PTY
- Inherits:
-
Object
- Object
- ZTK::PTY
- Defined in:
- lib/ztk/pty.rb
Overview
Ruby PTY Class Wrapper
Wraps the Ruby PTY class, providing better functionality.
Class Method Summary (collapse)
-
+ (Object) spawn(*args, &block)
Execute a process via a ruby-based PTY.
Class Method Details
+ (Object) spawn(*args, &block)
Execute a process via a ruby-based PTY.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/ztk/pty.rb', line 23 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 |