aboutsummaryrefslogtreecommitdiff
path: root/examples/compat.lua
diff options
context:
space:
mode:
Diffstat (limited to 'examples/compat.lua')
-rw-r--r--examples/compat.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/examples/compat.lua b/examples/compat.lua
index c00d44a..a59d964 100644
--- a/examples/compat.lua
+++ b/examples/compat.lua
@@ -5,12 +5,15 @@ local sys = require "system"
5 5
6 6
7 7
8if sys.is_windows then 8if sys.windows then
9 -- Windows holds multiple copies of environment variables, to ensure `getenv` 9 -- Windows holds multiple copies of environment variables, to ensure `getenv`
10 -- returns what `setenv` sets we need to use the `system.getenv` instead of 10 -- returns what `setenv` sets we need to use the `system.getenv` instead of
11 -- `os.getenv`. 11 -- `os.getenv`.
12 os.getenv = sys.getenv -- luacheck: ignore 12 os.getenv = sys.getenv -- luacheck: ignore
13 13
14 -- Set console output to UTF-8 encoding.
15 sys.setconsoleoutputcp(65001)
16
14 -- Set up the terminal to handle ANSI escape sequences on Windows. 17 -- Set up the terminal to handle ANSI escape sequences on Windows.
15 if sys.isatty(io.stdout) then 18 if sys.isatty(io.stdout) then
16 sys.setconsoleflags(io.stdout, sys.getconsoleflags(io.stdout) + sys.COF_VIRTUAL_TERMINAL_PROCESSING) 19 sys.setconsoleflags(io.stdout, sys.getconsoleflags(io.stdout) + sys.COF_VIRTUAL_TERMINAL_PROCESSING)