From 4b5ff1d4707e6d717ba034bea0bab700230c9108 Mon Sep 17 00:00:00 2001 From: Matthieu Napoli Date: Mon, 2 Dec 2024 13:10:56 +0100 Subject: [PATCH] Silency punycode warnings --- src/Components/ServerlessFramework.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Components/ServerlessFramework.php b/src/Components/ServerlessFramework.php index c6de184..2a8a51f 100644 --- a/src/Components/ServerlessFramework.php +++ b/src/Components/ServerlessFramework.php @@ -16,6 +16,12 @@ class ServerlessFramework { + private const IGNORED_LOGS = [ + 'https://dashboard.bref.sh', + '(node:83031) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.', + '(Use `node --trace-deprecation ...` to show where the warning was created)', + ]; + /** * @param array{ accessKeyId: string, secretAccessKey: string, sessionToken: string } $awsCredentials * @throws ProcessException @@ -35,6 +41,9 @@ public function deploy(int $deploymentId, string $environment, array $awsCredent async(function () use ($process, &$newLogs) { while (($chunk = $process->getStdout()->read()) !== null) { if (empty($chunk)) continue; + foreach (self::IGNORED_LOGS as $ignoredLog) { + if (str_contains($chunk, $ignoredLog)) continue 2; + } IO::verbose($chunk); $newLogs .= $chunk; } @@ -42,7 +51,9 @@ public function deploy(int $deploymentId, string $environment, array $awsCredent async(function () use ($process, &$newLogs) { while (($chunk = $process->getStderr()->read()) !== null) { if (empty($chunk)) continue; - if (str_contains($chunk, 'https://dashboard.bref.sh')) continue; + foreach (self::IGNORED_LOGS as $ignoredLog) { + if (str_contains($chunk, $ignoredLog)) continue 2; + } IO::verbose($chunk); $newLogs .= $chunk; }