From 33b6f383397d51074bd504a4067253ae65f5b77c Mon Sep 17 00:00:00 2001 From: Jonathan Coates Date: Sun, 12 Feb 2023 21:22:39 +0000 Subject: [PATCH] Hide the internal redirect methods in multishell Previously it was possible to access all methods of the multishell redirect by calling term.current(). This is definitely not intended, as it leaks all sorts of internals to the user. Also bump illuaminate - the new version is about twice as fast on my machine. --- gradle/libs.versions.toml | 2 +- .../computercraft/lua/rom/programs/advanced/multishell.lua | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 74114f7a8..5f97a1c13 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -51,7 +51,7 @@ fabric-loom = "1.0-SNAPSHOT" forgeGradle = "5.1.+" githubRelease = "2.2.12" ideaExt = "1.1.6" -illuaminate = "0.1.0-13-g689d73d" +illuaminate = "0.1.0-19-gee6e843" librarian = "1.+" minotaur = "2.+" mixinGradle = "0.7.+" diff --git a/projects/core/src/main/resources/data/computercraft/lua/rom/programs/advanced/multishell.lua b/projects/core/src/main/resources/data/computercraft/lua/rom/programs/advanced/multishell.lua index 51a5b4fd5..69e0447a5 100644 --- a/projects/core/src/main/resources/data/computercraft/lua/rom/programs/advanced/multishell.lua +++ b/projects/core/src/main/resources/data/computercraft/lua/rom/programs/advanced/multishell.lua @@ -78,6 +78,11 @@ local function launchProcess(bFocus, tProgramEnv, sProgramPath, ...) else tProcess.window = window.create(parentTerm, 1, 1, w, h, false) end + + -- Restrict the public view of the window to normal redirect functions. + tProcess.terminal = {} + for k in pairs(term.native()) do tProcess.terminal[k] = tProcess.window[k] end + tProcess.co = coroutine.create(function() os.run(tProgramEnv, sProgramPath, table.unpack(tProgramArgs, 1, tProgramArgs.n)) if not tProcess.bInteracted then @@ -87,7 +92,6 @@ local function launchProcess(bFocus, tProgramEnv, sProgramPath, ...) end end) tProcess.sFilter = nil - tProcess.terminal = tProcess.window tProcess.bInteracted = false tProcesses[nProcess] = tProcess if bFocus then