From 336e96a114555994b9e996c705c00d23b735d9d6 Mon Sep 17 00:00:00 2001 From: Yoshiya Hinosawa Date: Sun, 13 Nov 2022 17:35:28 +0900 Subject: fix(ext/flash): revert #16383 (graceful server startup/shutdown) (#16610) #16383 made some of Node compat test cases flaky in deno_std (and when it fails it causes segfaults). See https://github.com/denoland/deno_std/issues/2882 for details --- cli/tests/testdata/run/flash_shutdown/main.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 cli/tests/testdata/run/flash_shutdown/main.ts (limited to 'cli/tests/testdata/run') diff --git a/cli/tests/testdata/run/flash_shutdown/main.ts b/cli/tests/testdata/run/flash_shutdown/main.ts new file mode 100644 index 000000000..7f6985e34 --- /dev/null +++ b/cli/tests/testdata/run/flash_shutdown/main.ts @@ -0,0 +1,23 @@ +// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. + +// Deno.serve caused segfault with this example after #16383 +// refs: +// - https://github.com/denoland/deno/pull/16383 +// - https://github.com/denoland/deno_std/issues/2882 +// - revert https://github.com/denoland/deno/pull/16610 + +const ctl = new AbortController(); +Deno.serve(() => + new Promise((resolve) => { + resolve(new Response(new TextEncoder().encode("ok"))); + ctl.abort(); + }), { + signal: ctl.signal, + async onListen({ port }) { + const a = await fetch(`http://localhost:${port}`, { + method: "POST", + body: "", + }); + await a.text(); + }, +}); -- cgit v1.2.3