Jump to content

Topic on User talk:Daimona Eaytoy/Flow

Extension:SyntaxHighlight fail to invoke Pygments.exe on Windows (probably shell exec is broken on Windows)

7
Quinnj09 (talkcontribs)

Hey,

I wanted to reach out to you rather than have a discussion within a bug where its not really right to do so.

I managed to get the call to work using:

$result = Shell::command(

self::getPygmentizePath() .

' -l ' . $lexer .

' -f ' . 'html' .

' -O ' . implode( ',', $optionPairs )

)

Note that I had to add spaces before and after each - (dash)

But I then have the problem you described However, this isn't a complete solution, as another problem pops out: the process starts running, but never stops.

I wondered if you had any further suggestions on how to complete this solution?

Quinnj09 (talkcontribs)

I have also tried adding < NUL to the end:

[exec] MediaWiki\Shell\Command::execute: "C:\Python27\Scripts\pygmentize.exe -l sql -f html -O cssclass=mw-highlight,encoding=utf-8 < NUL"

But this (as expected) results in no output, so the code block is empty in the wiki page when being viewed by the user.

Daimona Eaytoy (talkcontribs)
Quinnj09 (talkcontribs)

@Daimona Eaytoy this leaves me in an annoying place (I know no fault to the mediawiki developers or yourself) in that I cannot upgrade from mediawiki 1.27.0 to 1.31.0 until I find a solution for this, as we require this to work once upgraded.

Now I know it works using PHP version 5.6.30 (cgi-fcgi) (because my production system uses this) but then its broken in PHP version 7.0.15 (cgi-fcgi) (which is my test system for testing mw 1.31.0)

Im wondering, if theres a way I can get the call:

"C:\Python27\Scripts\pygmentize.exe -l sql -f html -O cssclass=mw-highlight,encoding=utf-8"

to explicitly use version 5.6.30, if I had both versions installed.

Unfortunately PHP version 7 or higher is required for mw 1.31.0 from what I understand (but feel free to correct me)

Daimona Eaytoy (talkcontribs)

@Quinnj09 I understand, and I hope this will be fixed soon. MW 1.31 requires PHP 7+ (see Compatibility) and I can surely say that SyntaxHighlight did work on an older MW release (can't recall which one, maybe 1.30). Unfortunately, I can't give any more help at the moment.

Quinnj09 (talkcontribs)

@Daimona Eaytoy thats fine, thanks for your assistance though. One last question, at a guess do you think it would be this year a solution/fix will be found?

Daimona Eaytoy (talkcontribs)

@Quinnj09 I don't know :-) It depends on whether someone is planning to work on this soon. Any further update will be tracked on the phabricator task.

Reply to "Extension:SyntaxHighlight fail to invoke Pygments.exe on Windows (probably shell exec is broken on Windows)"