From a97d0bd2920620aee9cf2d4c3fdaed62bd835519 Mon Sep 17 00:00:00 2001 From: Jerry <27206617@qq.com> Date: Fri, 1 Sep 2017 21:16:04 +0800 Subject: [PATCH] Fix Arch determintion --- lib/php/libsdk/SDK/Config.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/php/libsdk/SDK/Config.php b/lib/php/libsdk/SDK/Config.php index 532514f..132be02 100644 --- a/lib/php/libsdk/SDK/Config.php +++ b/lib/php/libsdk/SDK/Config.php @@ -55,19 +55,18 @@ class Config if (NULL === self::$currentArchName) { /* XXX this might be not true for other compilers! */ passthru("where cl.exe >nul", $status); - if ($status) { - throw new Exception("Couldn't find cl.exe."); - } - - exec("cl.exe /? 2>&1", $a, $status); if ($status) { throw new Exception("Couldn't execute cl.exe."); } - if (preg_match(",x64,", $a[0])) { + exec("cl.exe /? 2>&1", $out); + + if (preg_match(",x64,", $out[0])) { self::setCurrentArchName("x64"); - } else { + } elseif (preg_match(",x86,", $out[0])) { self::setCurrentArchName("x86"); + } else { + throw new Exception("Couldn't determine Arch."); } }