diff --git a/cli/js/lib.deno.ns.d.ts b/cli/js/lib.deno.ns.d.ts index 6d354d0342..3c568f798a 100644 --- a/cli/js/lib.deno.ns.d.ts +++ b/cli/js/lib.deno.ns.d.ts @@ -1872,7 +1872,7 @@ declare namespace Deno { * const conn = await listener.accept(); * Deno.shutdown(conn.rid, Deno.ShutdownMode.Write); */ - export function shutdown(rid: number, how: ShutdownMode): void; + export function shutdown(rid: number, how: ShutdownMode): Promise; /** **UNSTABLE**: new API, yet to be vetted. * diff --git a/cli/js/ops/net.ts b/cli/js/ops/net.ts index 369f2ca3cf..d04c7ba8ff 100644 --- a/cli/js/ops/net.ts +++ b/cli/js/ops/net.ts @@ -22,8 +22,9 @@ export enum ShutdownMode { ReadWrite, // unused } -export function shutdown(rid: number, how: ShutdownMode): void { +export function shutdown(rid: number, how: ShutdownMode): Promise { sendSync("op_shutdown", { rid, how }); + return Promise.resolve(); } interface AcceptResponse { diff --git a/cli/ops/net.rs b/cli/ops/net.rs index 415d2cecc3..b46eedc682 100644 --- a/cli/ops/net.rs +++ b/cli/ops/net.rs @@ -342,10 +342,12 @@ struct ShutdownArgs { fn op_shutdown( isolate: &mut CoreIsolate, - _state: &State, + state: &State, args: Value, _zero_copy: Option, ) -> Result { + state.check_unstable("Deno.shutdown"); + let args: ShutdownArgs = serde_json::from_value(args)?; let rid = args.rid as u32;