Skip to content

Commit

Permalink
improved resource checking
Browse files Browse the repository at this point in the history
  • Loading branch information
jaf2bj authored and dg committed Jun 19, 2023
1 parent 3d0b6b8 commit db0a128
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/Tracy/Debugger/ProductionStrategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,13 @@ public function handleException(\Throwable $exception, bool $firstTime): void
(fn($logged) => require Debugger::$errorTemplate ?: __DIR__ . '/assets/error.500.phtml')(empty($e));

} elseif (Helpers::isCli()) {
// @ triggers E_NOTICE when strerr is closed since PHP 7.4
@fwrite(STDERR, "ERROR: {$exception->getMessage()}\n"
. (isset($e)
? 'Unable to log error. You may try enable debug mode to inspect the problem.'
: 'Check log to see more info.')
. "\n");
if (is_resource(STDERR)) {
fwrite(STDERR, "ERROR: {$exception->getMessage()}\n"
. (isset($e)
? 'Unable to log error. You may try enable debug mode to inspect the problem.'
: 'Check log to see more info.')
. "\n");
}
}
}

Expand Down

0 comments on commit db0a128

Please sign in to comment.