Method Stdio.File()->pipe()


Method pipe

File|zero pipe(void|int required_properties)

Description

This function creates a pipe between the object it was called in and an object that is returned.

Parameter required_properties

Binary or (`|()) of required PROP_ properties.

PROP_IPC

The resulting pipe may be used for inter process communication.

PROP_NONBLOCK

The resulting pipe supports nonblocking I/O.

PROP_SHUTDOWN

The resulting pipe supports shutting down transmission in either direction (see close()).

PROP_BUFFERED

The resulting pipe is buffered (usually 4KB).

PROP_BIDIRECTIONAL

The resulting pipe is bi-directional.

PROP_SEND_FD

The resulting pipe might support sending of file descriptors (see send_fd() and receive_fd() for details).

PROP_TTY

The resulting pipe is a pseudo-tty.

PROP_REVERSE

The resulting pipe supports communication "backwards" (but not necessarily "forwards", see PROP_BIDIRECTIONAL).

The default is PROP_NONBLOCK|PROP_BIDIRECTIONAL.

If PROP_BIDIRECTIONAL isn't specified, the read-end is this object, and the write-end is the returned object (unless PROP_REVERSE has been specified, in which case it is the other way around).

The two ends of a bi-directional pipe are indistinguishable.

For PROP_TTY the returned object is the slave (unless PROP_REVERSE has been specified).

If the File object this function is called in was open to begin with, it will be closed before the pipe is created.

Note

Calling this function with an argument of 0 is not the same as calling it with no arguments.

See also

Process.create_process(), send_fd(), receive_fd(), PROP_IPC, PROP_NONBLOCK, PROP_SEND_FD, PROP_SHUTDOWN, PROP_BUFFERED, PROP_REVERSE, PROP_BIDIRECTIONAL, PROP_TTY