This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
databrain's profile picture

Shutting Down Shell?

Started by databrain, 09 October 2013 - 04:53 PM
databrain #1
Posted 09 October 2013 - 06:53 PM
I'm trying to make a gaming OS. However, shell is running in the background. Is it possible to completely shut down shell on startup without messing with the bios?
Bubba #2
Posted 09 October 2013 - 07:14 PM
I am unsure what your question is: do you want to automatically start a program on startup, or are you looking to shut down the terminal program that is running in the above coroutine (if you don't know about coroutines, don't worry about shutting it down).

If the first question, you can simply name your program 'startup' and it will be executed on startup.

If the second, there's no need to shut down the term. It will not boost performance. If you want to prevent people from accessing the term, simply use os.pullEventRaw and make sure your program doesn't crash.

If you still insist that you need to shut down the term for some reason, you can try a top level coroutine override, which can be found by searching for "level coroutine override" in the search bar on these forms (because the minimum search term must be at least 4 letters long).
DerKoch #3
Posted 09 October 2013 - 07:14 PM
So you want to have the program started without typing the name into the shell, right?
Look into: Startup

Edit:
Or maybe I just misinterpreted your question…
AgentE382 #4
Posted 09 October 2013 - 07:46 PM
These are the relevant lines of bios.lua
-- Run the shell
local ok, err = pcall( function()
	parallel.waitForAny(
		function()
			os.run( {}, "rom/programs/shell" )
		end,
		function()
			rednet.run()
		end )
end )

You could read the rest of bios.lua and read rom/programs/shell to figure out how to get around that, but you'll need to override a global function with a custom version to do it. You'll also need to figure out how to hide the debug messages from the user and keep the shell from shutting the computer down when you make it error out.

EDIT: Double ninja'd. Wow.