Homec4science

Disable ANSI output if STDOUT is undefined

Authored by Joshua Spence <josh@joshuaspence.com> on Feb 12 2015, 21:31.

Description

Disable ANSI output if STDOUT is undefined

Summary:
Currently, I am hitting the following exception when attempting to use an out-of-date XHPAST binary:

[2015-02-11 18:02:10] EXCEPTION: (RuntimeException) Use of undefined constant STDOUT - assumed 'STDOUT' at [<phutil>/src/error/PhutilErrorHandler.php:221]
  #0 PhutilErrorHandler::handleError(integer, string, string, integer, array) called at [<phutil>/src/console/PhutilConsoleFormatter.php:33]
  #1 PhutilConsoleFormatter::getDisableANSI() called at [<phutil>/src/console/PhutilConsoleFormatter.php:51]
  #2 PhutilConsoleFormatter::formatString(string, string, string)
  #3 call_user_func_array(array, array) called at [<phutil>/src/console/format.php:7]
  #4 phutil_console_format(string, string, string) called at [<phutil>/src/parser/xhpast/bin/PhutilXHPASTBinary.php:68]
  #5 PhutilXHPASTBinary::getBuildInstructions() called at [<phutil>/src/parser/xhpast/bin/PhutilXHPASTBinary.php:84]
  #6 PhutilXHPASTBinary::getParserFuture(string) called at [<phabricator>/src/applications/phpast/controller/PhabricatorXHPASTViewRunController.php:14]
  #7 PhabricatorXHPASTViewRunController::processRequest() called at [<phabricator>/src/aphront/AphrontController.php:33]
  #8 AphrontController::handleRequest(AphrontRequest) called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:196]
  #9 AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink) called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:121]
  #10 AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [<phabricator>/webroot/index.php:19]

The simple fix is to disable ANSI output when STDOUT is undefined.

Test Plan: Attempted to use XHPAST and hit the correct (PhutilXHPASTBinary::getBuildInstructions()) exception.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D11739

Details

Committed
Joshua Spence <josh@joshuaspence.com>Feb 12 2015, 21:31
Pushed
aubortMar 17 2017, 12:03
Parents
rPHU4252753ed7b9: Make translations more modular so third-party libraries can translate their…
Branches
Unknown
Tags
Unknown

Event Timeline

Joshua Spence <josh@joshuaspence.com> committed rPHU5744a395bdbd: Disable ANSI output if STDOUT is undefined (authored by Joshua Spence <josh@joshuaspence.com>).Feb 12 2015, 21:31