Module: SubSpawn::POSIX::Internal::OpenPTY
- Extended by:
- FFI::Library
- Defined in:
- lib/subspawn/posix/ffi_helper.rb
Class Method Summary collapse
Class Method Details
.call(termios: nil, winsize: nil) ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/subspawn/posix/ffi_helper.rb', line 29 def self.call(termios: nil, winsize: nil) FFI::MemoryPointer.new(:int, 2) do |fds| FFI::MemoryPointer.new(:char, 4096) do |name| # max on linux = 4096 ret = self.openpty(fds[0], fds[1], name, termios, winsize) raise SystemCallError.new("OpenPTY Error", LFP.errno) unless ret == 0 return [*fds.read_array_of_int(2), name.read_string] end end end |