method
open
v2_1_10 -
Show latest stable
-
0 notes -
Class: PTY
- 1_8_6_287
- 1_8_7_72
- 1_8_7_330
- 1_9_1_378
- 1_9_2_180 (0)
- 1_9_3_125 (12)
- 1_9_3_392 (0)
- 2_1_10 (-38)
- 2_2_9 (0)
- 2_4_6 (6)
- 2_5_5 (0)
- 2_6_3 (0)
- What's this?
open()
public
Allocates a pty (pseudo-terminal).
In the block form, yields two arguments master_io, slave_file and the value of the block is returned from open.
The IO and File are both closed after the block completes if they haven’t been already closed.
PTY.open {|master, slave| p master #=> #<IO:masterpty:/dev/pts/1> p slave #=> #<File:/dev/pts/1> p slave.path #=> "/dev/pts/1" }
In the non-block form, returns a two element array, [master_io, slave_file].
master, slave = PTY.open # do something with master for IO, or the slave file
The arguments in both forms are:
master_io |
the master of the pty, as an IO. |
slave_file |
the slave of the pty, as a File. The path to the terminal device is available via slave_file.path |