diff options
| author | ruki <[email protected]> | 2021-04-06 00:08:13 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-04-06 00:08:13 +0800 |
| commit | 413c811f96ea6473b5028fd66592b3eee13422b8 (patch) | |
| tree | b423dd18e59f52819f8ae2b799865f99b91ac18f /xmake/core/base/cpu.lua | |
| parent | f6444f089c7a8c1c9e13ce2dd595661c988f318d (diff) | |
remove try
Diffstat (limited to 'xmake/core/base/cpu.lua')
| -rw-r--r-- | xmake/core/base/cpu.lua | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/xmake/core/base/cpu.lua b/xmake/core/base/cpu.lua index 271e2bbc4..bd89c23bc 100644 --- a/xmake/core/base/cpu.lua +++ b/xmake/core/base/cpu.lua @@ -172,7 +172,7 @@ function cpu._info() if cpuinfo == nil then cpuinfo = {} if os.host() == "macosx" then - local ok, sysctl_result = try {function() os.iorun("/usr/sbin/sysctl -n machdep.cpu.vendor machdep.cpu.model machdep.cpu.family machdep.cpu.features") end} + local ok, sysctl_result = os.iorun("/usr/sbin/sysctl -n machdep.cpu.vendor machdep.cpu.model machdep.cpu.family machdep.cpu.features") if ok and sysctl_result then sysctl_result = sysctl_result:trim():split('\n', {plain = true}) cpuinfo.vendor_id = sysctl_result[1] @@ -186,7 +186,7 @@ function cpu._info() elseif os.host() == "linux" then -- FIXME -- local proc_cpuinfo = io.readfile("/proc/cpuinfo") - local ok, proc_cpuinfo = try {function () return os.iorun("cat /proc/cpuinfo") end} + local ok, proc_cpuinfo = os.iorun("cat /proc/cpuinfo") if ok and proc_cpuinfo then for _, line in ipairs(proc_cpuinfo:split('\n', {plain = true})) do if not cpuinfo.vendor_id and line:startswith("vendor_id") then @@ -216,7 +216,7 @@ function cpu._info() cpuinfo.cpu_model = cpu_model end elseif os.host() == "bsd" then - local ok, dmesginfo = try {function() return os.iorun("dmesg") end} + local ok, dmesginfo = os.iorun("dmesg") if ok and dmesginfo then for _, line in ipairs(dmesginfo:split('\n', {plain = true})) do if not cpuinfo.vendor_id and line:find("Origin=", 1, true) then |
