mirror of
https://github.com/denoland/deno.git
synced 2025-01-11 08:33:43 -05:00
fix(cli): actually stabilize Deno.shutdown() (#9181)
This commit is contained in:
parent
9312d48e69
commit
b0132e8f90
2 changed files with 2 additions and 32 deletions
|
@ -515,8 +515,6 @@ unitTest(
|
|||
|
||||
unitTest(
|
||||
{
|
||||
// FIXME(bartlomieju)
|
||||
ignore: true,
|
||||
perms: { net: true },
|
||||
},
|
||||
async function netCloseWriteSuccess() {
|
||||
|
@ -537,36 +535,11 @@ unitTest(
|
|||
assertEquals(1, buf[0]);
|
||||
assertEquals(2, buf[1]);
|
||||
assertEquals(3, buf[2]);
|
||||
// Check write should be closed
|
||||
// Verify that the write end of the socket is closed.
|
||||
// TODO(piscisaureus): assert that thrown error is of a specific type.
|
||||
await assertThrowsAsync(async () => {
|
||||
await conn.write(new Uint8Array([1, 2, 3]));
|
||||
}, Deno.errors.BrokenPipe);
|
||||
closeDeferred.resolve();
|
||||
listener.close();
|
||||
conn.close();
|
||||
},
|
||||
);
|
||||
|
||||
unitTest(
|
||||
{
|
||||
// FIXME(bartlomieju)
|
||||
ignore: true,
|
||||
perms: { net: true },
|
||||
},
|
||||
async function netDoubleCloseWrite() {
|
||||
const addr = { hostname: "127.0.0.1", port: 3500 };
|
||||
const listener = Deno.listen(addr);
|
||||
const closeDeferred = deferred();
|
||||
listener.accept().then(async (conn) => {
|
||||
await closeDeferred;
|
||||
conn.close();
|
||||
});
|
||||
const conn = await Deno.connect(addr);
|
||||
conn.closeWrite(); // closing write
|
||||
assertThrows(() => {
|
||||
// Duplicated close should throw error
|
||||
conn.closeWrite();
|
||||
}, Deno.errors.NotConnected);
|
||||
closeDeferred.resolve();
|
||||
listener.close();
|
||||
conn.close();
|
||||
|
|
|
@ -346,10 +346,7 @@ async fn op_shutdown(
|
|||
args: Value,
|
||||
_zero_copy: BufVec,
|
||||
) -> Result<Value, AnyError> {
|
||||
super::check_unstable2(&state, "Deno.shutdown");
|
||||
|
||||
let args: ShutdownArgs = serde_json::from_value(args)?;
|
||||
|
||||
let rid = args.rid as u32;
|
||||
|
||||
let resource = state
|
||||
|
|
Loading…
Reference in a new issue