Class: TTY::Pager::SystemPager::PagerIO Private
- Inherits:
-
Object
- Object
- TTY::Pager::SystemPager::PagerIO
- Defined in:
- lib/tty/pager/system.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
A wrapper for an external process.
Instance Method Summary collapse
- #close ⇒ Object private
-
#initialize(command) ⇒ PagerIO
constructor
private
A new instance of PagerIO.
- #puts(*args) ⇒ Object private
- #write(*args) ⇒ Object private
Constructor Details
#initialize(command) ⇒ PagerIO
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of PagerIO.
221 222 223 224 225 |
# File 'lib/tty/pager/system.rb', line 221 def initialize(command) @command = command @io = IO.popen(@command, "w") @pid = @io.pid end |
Instance Method Details
#close ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
235 236 237 238 239 240 241 242 243 244 245 |
# File 'lib/tty/pager/system.rb', line 235 def close return true if @io.closed? @io.close _, status = Process.waitpid2(@pid, Process::WNOHANG) status.success? rescue Errno::ECHILD, Errno::EPIPE # on jruby 9x waiting on pid raises ECHILD # on ruby 2.5/2.6, closing a closed pipe raises EPIPE true end |
#puts(*args) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
231 232 233 |
# File 'lib/tty/pager/system.rb', line 231 def puts(*args) io_call(:puts, *args) end |
#write(*args) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
227 228 229 |
# File 'lib/tty/pager/system.rb', line 227 def write(*args) io_call(:write, *args) end |