Since passing parameters and results to the pygmentizer through stdin/stdout does not work on Windows,
i tried to use files for input and output. Pleas adjust the temporary directory to your environment.
Works for me on MediaWiki 1.33.
Greetings,
Ralf Naujokat
function ( $oldValue, &$ttl ) use ( $code, $lexer, $options, &$error ) { $optionPairs = []; foreach ( $options as $k => $v ) { $optionPairs[] = "{$k}={$v}"; } $tmp = tempnam( 'D:\\MediaWiki\\tmp', 'SH' ); $tmp_out = $tmp . ".out"; $tmp_in = $tmp . ".in"; file_put_contents( $tmp_in, $code ); $result = Shell::command( self::getPygmentizePath() . ' -l ' . $lexer . ' -f ' . 'html' . ' -O ' . implode( ',', $optionPairs ) . ' -o ' . $tmp_out . ' ' . $tmp_in ) // ->input( $code ) ->restrict( Shell::RESTRICT_DEFAULT | Shell::NO_NETWORK ) ->execute(); if ( $result->getExitCode() != 0 ) { $ttl = WANObjectCache::TTL_UNCACHEABLE; $error = $result->getStderr(); return null; } $out = file_get_contents( $tmp_out ); unlink( $tmp ); unlink( $tmp_in ); unlink( $tmp_out ); return $out; }