beremiz

Wait the debug thread has terminated before freeing PLC to avoid random segmentation fault.

Store working directory to globals copy, in order to be used in runtime.py.
import time,sys
def myprintfunc(arg):
print arg
sys.stdout.flush()
return arg