Fix Windows support:

* Improve OS detection
* Provide workaround for a proc_open bug.

Change-Id: I02b56cf2af1613406f7175a4ca053adb9d794bdd
This commit is contained in:
Victor Vasiliev 2012-04-24 04:47:53 +04:00
parent da06273ede
commit 606aaf30ac

View file

@ -64,7 +64,7 @@ class Scribunto_LuaStandaloneInterpreter extends Scribunto_LuaInterpreter {
} elseif ( PHP_INT_SIZE == 8 ) {
$path = 'lua5_1_5_linux_64_generic/lua';
}
} elseif ( PHP_OS == 'Windows' ) {
} elseif ( PHP_OS == 'Windows' || PHP_OS == 'WINNT' || PHP_OS == 'Win32' ) {
if ( PHP_INT_SIZE == 4 ) {
$path = 'lua5_1_4_Win32_bin/lua5.1.exe';
} elseif ( PHP_INT_SIZE == 8 ) {
@ -98,6 +98,15 @@ class Scribunto_LuaStandaloneInterpreter extends Scribunto_LuaInterpreter {
$cmd );
}
if ( php_uname( 's' ) == 'Windows NT' ) {
// Like the passthru() in older versions of PHP,
// PHP's invokation of cmd.exe in proc_open() is broken:
// http://news.php.net/php.internals/21796
// Unlike passthru(), it is not fixed in any PHP version,
// so we use the fix similar to one in wfShellExec()
$cmd = '"' . $cmd . '"';
}
wfDebug( __METHOD__.": creating interpreter: $cmd\n" );
$this->proc = proc_open(