From 959e17a1d26deb91e22a82ed14aec2d602544ea7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Belin?= Date: Fri, 6 Dec 2024 12:20:31 +0100 Subject: [PATCH] Code optimization --- src/fast_transformer.coffee | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/fast_transformer.coffee b/src/fast_transformer.coffee index 8f504a5..50da1a6 100644 --- a/src/fast_transformer.coffee +++ b/src/fast_transformer.coffee @@ -35,13 +35,13 @@ export class FastTransformer # Processes a PHP script. transform: (file) -> - await @listen() - url = new URL "http://127.0.0.1:#{@_port}/index.php" + port = await @listen() + url = new URL "http://127.0.0.1:#{port}/index.php" url.searchParams.set "file", resolve(file) response = await fetch url throw Error("An error occurred while processing the script: #{file}") unless response.ok - response.text() + await response.text() # Gets an ephemeral TCP port chosen by the system. _getPort: -> new Promise (fulfill, reject) ->