package eio

  1. Overview
  2. Docs
Effect-based direct-style IO API for OCaml

Install

dune-project
 Dependency

Authors

Maintainers

Sources

eio-1.4.tbz
sha256=ba11ad486f492130dbb486f2b3bdc4905643f10016806ddf86e9a34e4346aaa5
sha512=57ef2c137ccdc26d8029e636b6a4ee92da7c6b2f35954946bd56ca595d6947a8ec42f6f83f8552f73d6719e6ce2314cae2e2fad1686a387522935e6f90e9a8d9

doc/eio.unix/Eio_unix/Pty/index.html

Module Eio_unix.PtySource

Creating and controlling pseudoterminals.

Pseudoterminal (PTY) support.

A pseudoterminal is a pair of connected file descriptors emulating a terminal. The pseudoterminal device is used by a controlling program such as a terminal emulator, while the terminal device is used by a child process as its controlling terminal.

  • since 1.4
Sourcetype t

A connected pseudoterminal pair.

Sourceval open_pty : sw:Eio.Std.Switch.t -> unit -> t

open_pty ~sw () allocates a new pseudoterminal pair.

Both file descriptors are closed when sw finishes. The pty end is non-blocking; the tty end is blocking and so suitable as the child's controlling terminal.

Not a multi-domain-safe function on some platforms without reentrant ptsname support.

Sourceval pty : t -> Fd.t

pty t is the pseudoterminal-device end.

Sourceval tty : t -> Fd.t

tty t is the terminal-device end.

Sourceval name : t -> string

name t is the path of the terminal device.

source t reads the output the child writes to terminal.

sink t writes input for the child to read from its terminal.

Sourcetype winsize = {
  1. rows : int;
    (*

    Height of the terminal in character rows.

    *)
  2. cols : int;
    (*

    Width of the terminal in character columns.

    *)
  3. xpixel : int;
    (*

    Width in pixels (0 if unknown).

    *)
  4. ypixel : int;
    (*

    Height in pixels (0 if unknown).

    *)
}

Terminal window dimensions.

Sourceval get_window_size : Fd.t -> winsize

get_window_size fd returns the window size of terminal fd.

Sourceval set_window_size : Fd.t -> winsize -> unit

set_window_size fd ws sets the window size of terminal fd.

Setting it on the pty end updates the terminal and delivers SIGWINCH to the foreground process group attached to the terminal.

Sourcemodule Tc : sig ... end

Terminal attributes control. These raise Unix.Unix_error if fd is not a terminal.