--- spec/04-term_spec.lua | 3 +-- system/init.lua | 9 +++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) Index: luasystem-0.6.3/spec/04-term_spec.lua =================================================================== --- luasystem-0.6.3.orig/spec/04-term_spec.lua 2025-07-11 22:59:19.000000000 +0200 +++ luasystem-0.6.3/spec/04-term_spec.lua 2025-10-28 14:57:04.454973176 +0100 @@ -52,6 +52,7 @@ return assert(require("pl.compat").load("return " .. result))() end + end) @@ -993,5 +994,3 @@ end) end) - -end) Index: luasystem-0.6.3/system/init.lua =================================================================== --- luasystem-0.6.3.orig/system/init.lua 2025-07-11 22:59:19.000000000 +0200 +++ luasystem-0.6.3/system/init.lua 2025-10-28 14:56:17.538621949 +0100 @@ -11,6 +11,11 @@ -- To be used with `system.setconsoleoutputcp` and `system.setconsolecp`. -- @field CODEPAGE_UTF8 The Windows CodePage for UTF8. -- @within Terminal_UTF-8 +-- +-- NOTE: In some environments (e.g., busted tests), `require 'system'` might not +-- correctly load this `init.lua` file, leading to `system.CODEPAGE_UTF8` being nil. +-- If this occurs, explicitly use `require 'system.init'` or ensure the Lua +-- package path is configured to prioritize `system/init.lua` over `system.core`. system.CODEPAGE_UTF8 = 65001 do @@ -122,8 +127,8 @@ end -- export a reset function only upon testing - if _G._TEST then - function system._reset_global_backup() + function system._reset_global_backup() + if _G._TEST then global_backup = nil end end