diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2019-05-02 15:42:00 -0700 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2019-05-02 15:42:23 -0700 |
| commit | 8ef787572a983f769f6170818442d2b76211260c (patch) | |
| tree | f7c10f03b179ab13cabec85ec85e68c571de79a6 | |
| parent | 2b0481ed48c453aa98c7fae3e9e30816e25a5f19 (diff) | |
Fail-safe fix for windows if the windows color dll doesn't load
correctly.
| -rw-r--r-- | nomsu.lua | 14 | ||||
| -rwxr-xr-x | nomsu.moon | 12 |
2 files changed, 16 insertions, 10 deletions
@@ -10,12 +10,16 @@ if NOMSU_PREFIX then end COLOR_ENABLED = true if clibtype == "dll" then - local enable_colors = require('wincolors') - local ok, _ = pcall(enable_colors) - if not ok then - COLOR_ENABLED = false + local ok, enable_colors = pcall(require, 'wincolors') + COLOR_ENABLED = false + if ok then + local _ + ok, _ = pcall(enable_colors) + if ok then + COLOR_ENABLED = false + end end - os.execute("chcp 65001>nul") + pcall(os.execute, "chcp 65001>nul") end local List, Dict do @@ -13,12 +13,14 @@ export COLOR_ENABLED COLOR_ENABLED = true if clibtype == "dll" -- Enable colors: - enable_colors = require('wincolors') - ok,_ = pcall(enable_colors) - if not ok - COLOR_ENABLED = false + ok,enable_colors = pcall(require, 'wincolors') + COLOR_ENABLED = false + if ok + ok,_ = pcall(enable_colors) + if ok + COLOR_ENABLED = false -- Special hack to enable utf8 for windows console applications: - os.execute("chcp 65001>nul") + pcall(os.execute,"chcp 65001>nul") {:List, :Dict} = require 'containers' NOMSU_VERSION = List(NOMSU_VERSION) |
