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

startup behaving differently to other run programs

Started by KaoS, 18 January 2013 - 11:52 AM
KaoS #1
Posted 18 January 2013 - 12:52 PM
Hi guys, I ran into a most irksome issue yesterday and have yet to find the solution

In the shell program right by the end it locates your startup file and runs it, it uses the shell.run() command to do so. shell.run is just a wrapper for runLine() so they are essentially the same. after executing your startup file it starts the shell prompt from which you can launch programs, it uses the runLine() function to do so therefore we can assume they are run in the same way

if you run a program and include on the last line

os.queueEvent("terminate")
then the shell will error and terminate, this is important for top level overrides and it works fine however if you do the same in your startup file it does not terminate, as far as I can see the next os.pullEvent() is in the read() function used in the shell prompt but it does not terminate :(/>

does anyone know why?
theoriginalbit #2
Posted 18 January 2013 - 12:55 PM
doesn't read ( and sleep ) 'eat' all the events before starting? Meaning the event queue would be empty and it would not terminate as there is no terminate event…
KaoS #3
Posted 18 January 2013 - 12:57 PM
yes, but they eat them using os.pullEvent() so they still process the event, if it is "terminate" then the currently running program ends

try

os.queueEvent("terminate")
sleep(5)
theoriginalbit #4
Posted 18 January 2013 - 01:00 PM
yes, but they eat them using os.pullEvent() so they still process the event, if it is "terminate" then the currently running program ends

try

os.queueEvent("terminate")
sleep(5)
Hmmm ok… was just a theory…
KaoS #5
Posted 18 January 2013 - 01:01 PM
thanks :)/> I just wish you were right at the moment…. so frustrated lol