mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/SyntaxHighlight_GeSHi
synced 2024-11-23 22:13:40 +00:00
Pygmentize: report stderr when exit code != 0 and stdout is empty
Most python error messages are reported to stderr rather than stdout. In the event of a catastrophic failure executing the Pygments binary we are likely to need to report stderr so that folks can debug the problem with the executable. Bug: T364249 Change-Id: Id5e5dbc515fdcdeb6eec61aacbbb9cbeddc79fab
This commit is contained in:
parent
e96144ff92
commit
ee1a6c20d7
|
@ -298,7 +298,11 @@ class Pygmentize {
|
|||
|
||||
$output = $result->getStdout();
|
||||
if ( $result->getExitCode() != 0 ) {
|
||||
throw new PygmentsException( $output );
|
||||
if ( $output === "" || $output === null ) {
|
||||
// Stdout was empty, report stderr instead
|
||||
$output = $result->getStderr();
|
||||
}
|
||||
throw new PygmentsException( (string)$output );
|
||||
}
|
||||
|
||||
return $output;
|
||||
|
|
Loading…
Reference in a new issue