Spoiler
213 - 303 in multishell
-- Begin
parentTerm.clear()
setMenuVisible( false )
selectProcess( launchProcess( {
["shell"] = shell,
["multishell"] = multishell,
}, "/rom/programs/shell" ) )
redrawMenu()
-- Run processes
while #tProcesses > 0 do
-- Get the event
local tEventData = { os.pullEventRaw() }
local sEvent = tEventData[1]
if sEvent == "term_resize" then
-- Resize event
w,h = parentTerm.getSize()
resizeWindows()
redrawMenu()
elseif sEvent == "char" or sEvent == "key" or sEvent == "paste" or sEvent == "terminate" then
-- Keyboard event
-- Passthrough to current process
resumeProcess( nCurrentProcess, unpack( tEventData ) )
if cullProcess( nCurrentProcess ) then
setMenuVisible( #tProcesses >= 2 )
redrawMenu()
end
elseif sEvent == "mouse_click" then
-- Click event
local button, x, y = tEventData[2], tEventData[3], tEventData[4]
if bShowMenu and y == 1 then
-- Switch process
local tabStart = 1
for n=1,#tProcesses do
tabEnd = tabStart + string.len( tProcesses[n].sTitle ) + 1
if x >= tabStart and x <= tabEnd then
selectProcess( n )
redrawMenu()
break
end
tabStart = tabEnd + 1
end
else
-- Passthrough to current process
resumeProcess( nCurrentProcess, sEvent, button, x, (bShowMenu and y-1) or y )
if cullProcess( nCurrentProcess ) then
setMenuVisible( #tProcesses >= 2 )
redrawMenu()
end
end
elseif sEvent == "mouse_drag" or sEvent == "mouse_scroll" then
-- Other mouse event
local p1, x, y = tEventData[2], tEventData[3], tEventData[4]
if not (bShowMenu and y == 1) then
-- Passthrough to current process
resumeProcess( nCurrentProcess, sEvent, p1, x, (bShowMenu and y-1) or y )
if cullProcess( nCurrentProcess ) then
setMenuVisible( #tProcesses >= 2 )
redrawMenu()
end
end
else
-- Other event
-- Passthrough to all processes
local nLimit = #tProcesses -- Storing this ensures any new things spawned don't get the event
for n=1,nLimit do
resumeProcess( n, unpack( tEventData ) )
end
if cullProcesses() then
setMenuVisible( #tProcesses >= 2 )
redrawMenu()
end
end
if bWindowsResized then
-- Pass term_resize to all processes
local nLimit = #tProcesses -- Storing this ensures any new things spawned don't get the event
for n=1,nLimit do
resumeProcess( n, "term_resize" )
end
bWindowsResized = false
if cullProcesses() then
setMenuVisible( #tProcesses >= 2 )
redrawMenu()
end
end
end
After digging through the code ive found in bios.lua (lines 555-570) piece of code that's responsible for my suffering.
-- Run the shell
local ok, err = pcall( function()
parallel.waitForAny(
function()
if term.isColour() then
os.run( {}, "rom/programs/advanced/multishell" )
else
os.run( {}, "rom/programs/shell" )
end
os.run( {}, "rom/programs/shutdown" )
end,
function()
rednet.run()
end )
end )
And the main question: how to override it? I dont want to call 'multishell' from "rom/programs/advanced/" but my own version. Is it possible to shut everything down, and then start my own environment?