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

After os.reboot() next Line is still running

Started by ichim, 09 January 2013 - 08:34 AM
ichim #1
Posted 09 January 2013 - 09:34 AM
First of: I do my best with my English,but im from Germany.

ComputerCraft Version Information: 1.481 Client / 1.481 Server, Minecraft 1.4.6
Other Bugs i have (already written here in Forum):
Freezing Server while Programming turtle.

Description of Bug:
After the code os.reboot() the next line will still be executed.

Steps to Reproduce Bug:
Placed another turtle and put in the Code as startup:


print("Im Online")
sleep(5)
os.reboot()
turtle.forward()

turtles is moving one Block forward every 5seconds. also testet with "turtle.up()".
Server aint saying "Overloadded"

used turtles:
Wireless turtle with Axe and turtle with nothing special.
Cloudy #2
Posted 09 January 2013 - 09:36 AM
While I realise this is not what you intended to happen, is it really a big thing? Nobody would structure their code so that there's a function after a reboot command. That wouldn't happen.
Cranium #3
Posted 09 January 2013 - 09:38 AM
I agree, os.reboot should be at the end of a code block, nothing else. It used to be that reboot() would be instant, but now that it takes some time, it might be running the next function before the full restart.
I suggest not having functions after rebooting.
ichim #4
Posted 09 January 2013 - 09:39 AM
Yeah i think it is.

Was writing something and cause i had to edit inside the Programm i put a os.reboot() after the Line where the edited was.

And then: the first Run worked … the second somehow failed … tried over and over. Took hours to get the Problem …

I think this is really bad for debugging your Programm (or mine at least :Þ)

Now i also know why in my other Programm always sending a double broadcast, when im restarting to reload the code (Editing the Programm with an other Editor, cause its much more easy to do)
ichim #5
Posted 09 January 2013 - 09:54 AM
I thought a bit about it.

It may be fixed by adding a little delay in os.reboot(),IF its build like: shutdown, startup.

I came to this cause this problem wont accour if the turtle is shutdown and then turned on again.


If you will fix this is your opinion, but i hope you will, cause im really angry of it at the time :Þ
Eric #6
Posted 23 January 2013 - 07:00 AM
Could you not fix os.reboot() to make it call coroutine.yield("os_reboot"), which could then bubble the control flow all the way up to the java code, which would then choose simply not to resume the coroutine?
Cloudy #7
Posted 23 January 2013 - 07:14 AM
Why bother? If you're executing code after a reboot you're doing things wrong.
Lyqyd #8
Posted 23 January 2013 - 10:21 AM
If you're using reboots as a debugging tool, you are doing it wrong.
dan200 #9
Posted 24 January 2013 - 02:21 AM
I can fix this quite easilly. Will do now.
NeverCast #10
Posted 24 January 2013 - 09:22 AM
I will be interested in how this will affect other parts of code, will it only be the shutdown/reboot that is handled immediately, or will other things be handled differently