redirecting bullocks
This commit is contained in:
parent
c8380551c2
commit
9de1949dab
@ -11,6 +11,7 @@ class logger:
|
|||||||
txt=txt.split("\n")[-1][:254]
|
txt=txt.split("\n")[-1][:254]
|
||||||
tpt.log(txt)
|
tpt.log(txt)
|
||||||
#sys.stdout=logger()
|
#sys.stdout=logger()
|
||||||
|
#sys.stderr=logger()
|
||||||
|
|
||||||
element={"none":0,"dust":1,"watr":2,"oil":3,"fire":4,"stne":5,"lava":6,"gunp":7,
|
element={"none":0,"dust":1,"watr":2,"oil":3,"fire":4,"stne":5,"lava":6,"gunp":7,
|
||||||
"nitr":8,"clne":9,"gas":10,"plex":11,"goo":12,"icei":13,"metl":14,"sprk":15,
|
"nitr":8,"clne":9,"gas":10,"plex":11,"goo":12,"icei":13,"metl":14,"sprk":15,
|
||||||
@ -68,16 +69,18 @@ def fork_status():
|
|||||||
def fork_unblock():
|
def fork_unblock():
|
||||||
pass#i need to implement this some day.
|
pass#i need to implement this some day.
|
||||||
def error(ex):
|
def error(ex):
|
||||||
name,_,_=repr(ex).partition("(")
|
err=traceback.format_exc()
|
||||||
tpt.log("%s: %s"%(name,str(ex)))
|
sys.stdout.write(err)
|
||||||
|
|
||||||
def clean():
|
def clean():
|
||||||
#add any functions that must be reachable here.
|
#add any functions that must be reachable here.
|
||||||
copy=["__builtins__","__name__","__doc__","__package__",'tpt','clean',
|
"""copy=["__builtins__","__name__","__doc__","__package__",'tpt','clean',
|
||||||
'element','fork','_fork','fork_status','fork_unblock','sys']
|
'element','fork','_fork','fork_status','fork_unblock','sys']
|
||||||
handle.glob={}
|
handle.glob={}
|
||||||
for item in copy:
|
for item in copy:
|
||||||
handle.glob[item]=globals()[item]
|
handle.glob[item]=globals()[item]"""
|
||||||
|
handle.glob=globals()
|
||||||
|
handle.buf=""
|
||||||
|
|
||||||
def handle(txt):
|
def handle(txt):
|
||||||
try:
|
try:
|
||||||
@ -88,15 +91,13 @@ def handle(txt):
|
|||||||
_handle(txt)
|
_handle(txt)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
error(ex)
|
error(ex)
|
||||||
print "### -------------------- trace"
|
|
||||||
traceback.print_exc()
|
|
||||||
|
|
||||||
def _handle(txt):
|
def _handle(txt):
|
||||||
#print "handling '%s'"%txt
|
#print "handling '%s'"%txt
|
||||||
exec txt in handle.glob
|
try:
|
||||||
if(False):
|
exec txt
|
||||||
tpt.console_more()
|
except Exception as ex:
|
||||||
else:
|
error(ex)
|
||||||
tpt.console_less()
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user