From: Tim Starling Date: Sat, 18 Jun 2005 05:09:27 +0000 (+0000) Subject: Generic cygwin hack X-Git-Tag: 1.5.0beta1~167 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/%22%24ccApp/ecrire?a=commitdiff_plain;h=6668f232d7601692567f9306668efd05fea87d92;p=lhc%2Fweb%2Fwiklou.git Generic cygwin hack --- diff --git a/includes/Math.php b/includes/Math.php index 3506394ab9..d24f30d45d 100644 --- a/includes/Math.php +++ b/includes/Math.php @@ -57,16 +57,23 @@ class MathRenderer { return $this->_error( 'math_bad_tmpdir' ); } - if( !is_executable( $wgTexvc ) ) { + if( function_exists( 'is_executable' ) && !is_executable( $wgTexvc ) ) { return $this->_error( 'math_notexvc' ); } - $cmd = $wgTexvc.' '. - wfEscapeShellArg($wgTmpDirectory).' '. - wfEscapeShellArg($wgMathDirectory).' '. - wfEscapeShellArg($this->tex).' '. - wfEscapeShellArg($wgInputEncoding); - wfDebug( 'TeX: '.$cmd ); + $cmd = $wgTexvc . ' ' . + escapeshellarg( $wgTmpDirectory ).' '. + escapeshellarg( $wgMathDirectory ).' '. + escapeshellarg( $this->tex ).' '. + escapeshellarg( $wgInputEncoding ); + + if ( wfIsWindows() ) { + # Invoke it within cygwin sh, because texvc expects sh features in its default shell + $cmd = 'sh -c ' . wfEscapeShellArg( $cmd ); + } + + wfDebug( "TeX: $cmd\n" ); $contents = `$cmd`; + wfDebug( "TeX output:\n $contents\n---\n" ); if (strlen($contents) == 0) { return $this->_error( 'math_unknown_error' );