Log STDERR from mathoids cli output

When $wgMathoidCli is misconfigured the error message was misleading.
It was reported that the specified file was not executable, even though
other reasons are possible (e.g., nodejs misconfigured).  

Therefore, we capture STDERR and add it to the error log.

Bug: T198564
Change-Id: I7d0ae0f3ab4789124f9ff1533e7712ca31233f9e
This commit is contained in:
RazeSoldier 2018-11-20 18:34:41 +08:00 committed by Physikerwelt
parent e81d53bc8e
commit 27091b55a0

View file

@ -123,13 +123,14 @@ class MathMathMLCli extends MathMathML {
$cmd->input( $json_req );
$result = $cmd->execute();
if ( $result->getExitCode() != 0 ) {
$errorMsg = $result->getStderr();
LoggerFactory::getInstance( 'Math' )->error( 'Can not process {req} with config
{conf} returns {res}', [
'req' => $req,
'conf' => var_export( $wgMathoidCli, true ),
'res' => var_export( $result, true ),
] );
throw new MWException( "Mathoid cli '$wgMathoidCli[0]' is not executable." );
throw new MWException( "Failed to execute Mathoid cli '$wgMathoidCli[0]', reason: $errorMsg" );
}
$res = json_decode( $result->getStdout() );
if ( !$res ) {