nvim_runtime_lua

uv.uv_pipe_t

uv_pipe_t - Pipe handle

[uv_handle_t][] and [uv_stream_t][] functions also apply.

Pipe handles provide an abstraction over local domain sockets on Unix and named pipes on Windows.

local pipe = uv.new_pipe(false)

pipe:bind('/tmp/sock.test')

pipe:listen(128, function()
  local client = uv.new_pipe(false)
  pipe:accept(client)
  client:write("hello!\n")
  client:close()
end)

Methods11

function uv_pipe_t.open(fd: integer) -> (success 0 | nil, err nil | string, err_name uv.error_name | nil)

Open an existing file descriptor or [uv_handle_t][] as a pipe. Note: The file descriptor is set to non-blocking mode.

function uv_pipe_t.bind(name: string) -> (success 0 | nil, err nil | string, err_name uv.error_name | nil)

Bind the pipe to a file path (Unix) or a name (Windows). Note: Paths on Unix get truncated to sizeof(sockaddrun.sunpath) bytes, typically between 92 and 108 bytes.

function uv_pipe_t.connect(name: string, callback: fun(err: nil | string) -> nil | nil) -> (connect uv.uv_connect_t | nil, err nil | string, err_name uv.error_name | nil)

Connect to the Unix domain socket or the named pipe. Note: Paths on Unix get truncated to sizeof(sockaddrun.sunpath) bytes, typically between 92 and 108 bytes.

function uv_pipe_t.getsockname() -> (name nil | string, err nil | string, err_name uv.error_name | nil)

Get the name of the Unix domain socket or the named pipe.

function uv_pipe_t.getpeername() -> (name nil | string, err nil | string, err_name uv.error_name | nil)

Get the name of the Unix domain socket or the named pipe to which the handle is connected.

function uv_pipe_t.pending_instances(count: integer)

Set the number of pending pipe instance handles when the pipe server is waiting for connections. Note: This setting applies to Windows only.

function uv_pipe_t.pending_count() -> integer

Returns the pending pipe count for the named pipe.

function uv_pipe_t.pending_type() -> string

Used to receive handles over IPC pipes.

First - call uv.pipe_pending_count(), if it's > 0 then initialize a handle of the given type, returned by uv.pipe_pending_type() and call uv.accept(pipe, handle).

function uv_pipe_t.chmod(flags: string) -> (success 0 | nil, err nil | string, err_name uv.error_name | nil)

Alters pipe permissions, allowing it to be accessed from processes run by different users. Makes the pipe writable or readable by all users. flags are: "r", "w", "rw", or "wr" where r is READABLE and w is WRITABLE. This function is blocking.

function uv_pipe_t.bind2(name: string, flags: nil | table | integer) -> (success 0 | nil, err nil | string, err_name uv.error_name | nil)

Bind the pipe to a file path (Unix) or a name (Windows).

Flags:

  • If type(flags) is number, it must be 0 or uv.constants.PIPE_NO_TRUNCATE.
  • If type(flags) is table, it must be {} or { no_truncate = true|false }.
  • If type(flags) is nil, it use default value 0.
  • Returns EINVAL for unsupported flags without performing the bind operation.

Supports Linux abstract namespace sockets. namelen must include the leading '0' byte but not the trailing nul byte. Note:

  1. Paths on Unix get truncated to sizeof(sockaddrun.sunpath) bytes,
  2. typically between 92 and 108 bytes.

  3. New in version 1.46.0.
function uv_pipe_t.connect2(name: string, flags: nil | table | integer, callback: fun(err: nil | string) -> nil | nil) -> (connect uv.uv_connect_t | nil, err nil | string, err_name uv.error_name | nil)

Connect to the Unix domain socket or the named pipe.

Flags:

  • If type(flags) is number, it must be 0 or uv.constants.PIPE_NO_TRUNCATE.
  • If type(flags) is table, it must be {} or { no_truncate = true|false }.
  • If type(flags) is nil, it use default value 0.
  • Returns EINVAL for unsupported flags without performing the bind operation.

Supports Linux abstract namespace sockets. namelen must include the leading nul byte but not the trailing nul byte. Note:

  1. Paths on Unix get truncated to sizeof(sockaddrun.sunpath) bytes,
  2. typically between 92 and 108 bytes.

  3. New in version 1.46.0.