Name
PTY — Pseudo TTY access module
Synopsis
The PTY
module executes commands as if their
standard I/O is connected to ttys.
Required Library
require “pty”
Module Functions
getpty(
command
)
spawn(
command
)
Reserves a
PTY
, executescommand
over thePTY
, and returns an array of three elements (reading I/O, writing I/O, and the PID of the child process). With a block, the array is passed to the block as block parameters.SIGCHLD
is captured whilecommand
is running.protect_signal {
...
}
Protects block execution from
SIGCHLD
signal exception. This is required to invoke other subprocesses while using anyPTY
.reset_signal
Disables to handle
SIGCHLD
whilePTY
subprocess is active.
Get Ruby in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.