From 8ef787572a983f769f6170818442d2b76211260c Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Thu, 2 May 2019 15:42:00 -0700 Subject: Fail-safe fix for windows if the windows color dll doesn't load correctly. --- nomsu.lua | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'nomsu.lua') diff --git a/nomsu.lua b/nomsu.lua index ee2625c..f35c4a1 100644 --- a/nomsu.lua +++ b/nomsu.lua @@ -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 -- cgit v1.2.3