diff options
author | Leo Kettmeir <crowlkats@toaxl.com> | 2022-05-18 22:00:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-18 22:00:11 +0200 |
commit | 4e1ca1d1787f25ab9f0a72ccf9d8028f70b3a7ed (patch) | |
tree | 2d0062ec1dd864c7ed98301119ac5f1c133f844a /cli/tests/unit/tls_test.ts | |
parent | 5ad8919d642b646caa3328930dd1a3f290bc587e (diff) |
refactor: use spawn API across codebase (#14414)
Diffstat (limited to 'cli/tests/unit/tls_test.ts')
-rw-r--r-- | cli/tests/unit/tls_test.ts | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/cli/tests/unit/tls_test.ts b/cli/tests/unit/tls_test.ts index 05eced64e..c9f22b75b 100644 --- a/cli/tests/unit/tls_test.ts +++ b/cli/tests/unit/tls_test.ts @@ -1019,20 +1019,14 @@ function createHttpsListener(port: number): Deno.Listener { } async function curl(url: string): Promise<string> { - const curl = Deno.run({ - cmd: ["curl", "--insecure", url], - stdout: "piped", + const { status, stdout } = await Deno.spawn("curl", { + args: ["--insecure", url], }); - try { - const [status, output] = await Promise.all([curl.status(), curl.output()]); - if (!status.success) { - throw new Error(`curl ${url} failed: ${status.code}`); - } - return new TextDecoder().decode(output); - } finally { - curl.close(); + if (!status.success) { + throw new Error(`curl ${url} failed: ${status.code}`); } + return new TextDecoder().decode(stdout); } Deno.test( |