Skip to content

Commit

Permalink
feat: deprecate Deno.shutdown() (#22067)
Browse files Browse the repository at this point in the history
For removal in Deno v2.

---------

Signed-off-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
  • Loading branch information
iuioiua and bartlomieju authored Jan 24, 2024
1 parent 4c0b66b commit 5a4d693
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
3 changes: 3 additions & 0 deletions ext/net/lib.deno_net.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,9 @@ declare namespace Deno {
* Deno.shutdown(conn.rid);
* ```
*
* @deprecated Use {@linkcode Deno.Conn.closeWrite} instead.
* {@linkcode Deno.shutdown} will be removed in Deno 2.0.
*
* @category Network
*/
export function shutdown(rid: number): Promise<void>;
Expand Down
11 changes: 9 additions & 2 deletions runtime/js/90_deno_ns.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

import { core } from "ext:core/mod.js";
import { core, internals } from "ext:core/mod.js";
const {
op_net_listen_udp,
op_net_listen_unixpacket,
Expand Down Expand Up @@ -117,7 +117,14 @@ const denoNs = {
connectTls: tls.connectTls,
listenTls: tls.listenTls,
startTls: tls.startTls,
shutdown: net.shutdown,
shutdown(rid) {
internals.warnOnDeprecatedApi(
"Deno.shutdown()",
new Error().stack,
"Use `Deno.Conn.closeWrite()` instead.",
);
net.shutdown(rid);
},
fstatSync: fs.fstatSync,
fstat: fs.fstat,
fsyncSync: fs.fsyncSync,
Expand Down

0 comments on commit 5a4d693

Please sign in to comment.