From 3e1220fa0ee1b6209faa9cfc19b35fa9cc9399e8 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Fri, 27 Aug 2021 22:42:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A7=E5=88=B6=E5=8F=B0=E6=89=A7=E8=A1=8Clu?= =?UTF-8?q?a=E4=BB=A3=E7=A0=81=E6=97=B6sudo=E6=A8=A1=E5=BC=8F=E5=BC=80?= =?UTF-8?q?=E5=85=B3=E4=BC=9A=E5=BD=B1=E5=93=8D=E8=BE=93=E5=87=BA=E6=96=87?= =?UTF-8?q?=E6=9C=AC=E9=A2=9C=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/scenes/app_console.lua | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/parts/scenes/app_console.lua b/parts/scenes/app_console.lua index d6fe5a14..711f4561 100644 --- a/parts/scenes/app_console.lua +++ b/parts/scenes/app_console.lua @@ -910,13 +910,19 @@ function scene.keyDown(key) log{C.lC,"> "..input} local code,err=loadstring(input:sub(2)) if code then - if not sudomode then setfenv(code,userG)end + local resultColor + if sudomode then + resultColor=C.lY + else + setfenv(code,userG) + resultColor=C.lG + end local success,result=pcall(code) if success then if result~=nil then - log{C.lG,">> "..tostring(result)} + log{resultColor,">> "..tostring(result)} else - log{C.lG,"done"} + log{resultColor,"done"} end else log{C.R,result}