summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
authorValentin Anger <syrupthinker@gryphno.de>2020-05-24 15:43:40 +0200
committerGitHub <noreply@github.com>2020-05-24 09:43:40 -0400
commitb7f0b073bb7585ea932a5783ff4ea88843a46b1b (patch)
treee81848f02fadb45f262a609d66380bcdd5ce5256 /cli
parentf6e31603563bad38c663494ddec6a363989b5786 (diff)
Add unstable checks for unix transport (#5818)
Also remove the unix example from the stable documentation to stay in line with the `Deno.listen` one
Diffstat (limited to 'cli')
-rw-r--r--cli/js/lib.deno.ns.d.ts3
-rw-r--r--cli/js/lib.deno.unstable.d.ts2
-rw-r--r--cli/ops/net.rs4
3 files changed, 6 insertions, 3 deletions
diff --git a/cli/js/lib.deno.ns.d.ts b/cli/js/lib.deno.ns.d.ts
index 2415214a5..fd0c0e6d7 100644
--- a/cli/js/lib.deno.ns.d.ts
+++ b/cli/js/lib.deno.ns.d.ts
@@ -1612,10 +1612,9 @@ declare namespace Deno {
* const conn2 = await Deno.connect({ hostname: "192.0.2.1", port: 80 });
* const conn3 = await Deno.connect({ hostname: "[2001:db8::1]", port: 80 });
* const conn4 = await Deno.connect({ hostname: "golang.org", port: 80, transport: "tcp" });
- * const conn5 = await Deno.connect({ path: "/foo/bar.sock", transport: "unix" });
* ```
*
- * Requires `allow-net` permission for "tcp" and `allow-read` for unix. */
+ * Requires `allow-net` permission for "tcp". */
export function connect(options: ConnectOptions): Promise<Conn>;
export interface ConnectTlsOptions {
diff --git a/cli/js/lib.deno.unstable.d.ts b/cli/js/lib.deno.unstable.d.ts
index 9bb4cfb90..86bdd7b12 100644
--- a/cli/js/lib.deno.unstable.d.ts
+++ b/cli/js/lib.deno.unstable.d.ts
@@ -1067,7 +1067,7 @@ declare namespace Deno {
* const conn5 = await Deno.connect({ path: "/foo/bar.sock", transport: "unix" });
* ```
*
- * Requires `allow-net` permission for "tcp" and `allow-read` for unix. */
+ * Requires `allow-net` permission for "tcp" and `allow-read` for "unix". */
export function connect(
options: ConnectOptions | UnixConnectOptions
): Promise<Conn>;
diff --git a/cli/ops/net.rs b/cli/ops/net.rs
index 59707e291..ae5bcb9bb 100644
--- a/cli/ops/net.rs
+++ b/cli/ops/net.rs
@@ -302,6 +302,7 @@ fn op_connect(
transport_args: ArgsEnum::Unix(args),
} if transport == "unix" => {
let address_path = net_unix::Path::new(&args.path);
+ state.check_unstable("Deno.connect");
state.check_read(&address_path)?;
let op = async move {
let path = args.path;
@@ -524,6 +525,9 @@ fn op_listen(
transport,
transport_args: ArgsEnum::Unix(args),
} if transport == "unix" || transport == "unixpacket" => {
+ if transport == "unix" {
+ state.check_unstable("Deno.listen");
+ }
if transport == "unixpacket" {
state.check_unstable("Deno.listenDatagram");
}