diff --git a/docs.md b/docs.md index a0d6f6c5..1b5e40cc 100644 --- a/docs.md +++ b/docs.md @@ -1943,6 +1943,51 @@ read_pipe:read_start(function(err, chunk) print(chunk) end) ``` +### `uv.pipe_bind2(pipe, name, [flags])` + +> method form `pipe:bind2(name, [flags])` + +**Parameters:** +- `pipe`: `uv_pipe_t userdata` +- `name`: `string` +- `flags`: `integer`(default: 0) + +Bind the pipe to a file path (Unix) or a name (Windows). + +`Flags` must be zero or `uv.constants.PIPE_NO_TRUNCATE`. 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. + +**Returns:** `0` or `fail` + +**Note**: +1. Paths on Unix get truncated to sizeof(sockaddr_un.sun_path) bytes, +typically between 92 and 108 bytes. +2. New in version 1.46.0. + +### `uv.pipe_connect2(pipe, name, [flags], [callback])` + +> method form `pipe:connect2(name, [flags], [callback])` + +**Parameters:** +- `pipe`: `uv_pipe_t userdata` +- `name`: `string` +- `flags`: `integer`(default: 0) +- `callback`: `callable` or `nil` + - `err`: `nil` or `string` + +Connect to the Unix domain socket or the named pipe. + +`Flags` must be zero or `uv.constants.PIPE_NO_TRUNCATE`. 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. + +**Returns:** `uv_connect_t userdata` or `fail` + +**Note**: +1. Paths on Unix get truncated to sizeof(sockaddr_un.sun_path) bytes, +typically between 92 and 108 bytes. +2. New in version 1.46.0. ## `uv_tty_t` — TTY handle diff --git a/tests/test-pipe.lua b/tests/test-pipe.lua index e079f79a..bc553661 100644 --- a/tests/test-pipe.lua +++ b/tests/test-pipe.lua @@ -97,6 +97,7 @@ return require('lib/tap')(function (test) end, "1.41.0") test("pipe getsockname abstract", function(print, p, expect, uv) + -- https://github.com/libuv/libuv/blob/v1.x/test/test-pipe-getsockname.c#L164-L210 local isWindows = require('lib/utils').isWindows local isLinux = require('lib/utils').isLinux