diff --git a/lib/util/ktutil.inc b/lib/util/ktutil.inc index 85608e5..8e8b4dc 100644 --- a/lib/util/ktutil.inc +++ b/lib/util/ktutil.inc @@ -206,14 +206,27 @@ class KTUtil { $aOutput = array(); $iRet = ''; - exec($sCmd, $aOutput, $iRet); + if (OS_WINDOWS){ + $wait = false; + if(isset($aOptions['exec_wait']) && ($aOptions['exec_wait'] == 'true')){ + $wait = true; + } + + $WshShell = new COM("WScript.Shell"); + $res = $WshShell->Run($sCmd, 0, $wait); + + $iRet = 0; + $aOutput = array($res); + }else{ + exec($sCmd, $aOutput, $iRet); + } + $aRet['ret'] = $iRet; $aRet['out'] = $aOutput; return $aRet; } // }}} - - + // {{{ winexec /** * Execute a command on a windows platform. @@ -529,12 +542,6 @@ class KTUtil { return $sCommand . ".exe"; } - $result = KTUtil::checkForStackCommand($sConfigVar); - if (!empty($result)) - { - return $result; - } - $sExecSearchPath = $oKTConfig->get("KnowledgeTree/execSearchPath"); $sExecSearchPath .= PATH_SEPARATOR . KT_DIR . "/../common/"; $sExecSearchPath .= PATH_SEPARATOR . KT_DIR . "/../bin/xpdf/"; @@ -556,47 +563,6 @@ class KTUtil { } // }}} - function checkForStackCommand($configCommand) - { - $config = KTConfig::getSingleton(); - $stackPath = realpath(KT_DIR . '/..'); - - switch ($configCommand) - { - case 'externalBinary/php': - if (OS_WINDOWS) - { - $script = $stackPath . '/php/php.exe'; - } - else - { - $script = $stackPath . '/php/bin/php'; - } - break; - case 'externalBinary/python': - if (OS_WINDOWS) - { - $script = $stackPath . '/openoffice/openoffice/program/python.bat'; - } - else - { - $script = $stackPath . '/openoffice/program/python'; - } - break; - case 'externalBinary/java': - $script = $stackPath . '/j2re/bin/java'; - break; - default: - return null; - } - if (is_file($script)) - { - return $script; - } - return false; - } - - // now accepts strings OR arrays! // {{{ addQueryString function addQueryString($url, $qs) {