Skip to content

Commit

Permalink
Silency punycode warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
mnapoli committed Dec 2, 2024
1 parent 10c25da commit 4b5ff1d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/Components/ServerlessFramework.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -35,14 +41,19 @@ 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;
}
});
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;
}
Expand Down

0 comments on commit 4b5ff1d

Please sign in to comment.