From 6668f232d7601692567f9306668efd05fea87d92 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Sat, 18 Jun 2005 05:09:27 +0000 Subject: [PATCH] Generic cygwin hack --- includes/Math.php | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) 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' ); -- 2.20.1