mirror of
https://github.com/evennia/evennia.git
synced 2026-03-25 09:16:32 +01:00
Made sure the command sends raw evals as raw data. Resolves #816. This removes color completely from raw evals but they will still be present if using self.msg() in the evaluation (if doing so, this particular side effect still exists too though).
This commit is contained in:
parent
1348fae5a0
commit
90c6ade56d
1 changed files with 6 additions and 6 deletions
|
|
@ -194,23 +194,23 @@ class CmdPy(MuxCommand):
|
|||
t0 = timemeasure()
|
||||
ret = eval(pycode_compiled, {}, available_vars)
|
||||
t1 = timemeasure()
|
||||
duration = " (%.4f ms)" % ((t1 - t0) * 1000)
|
||||
duration = " (runtime ~ %.4f ms)" % ((t1 - t0) * 1000)
|
||||
else:
|
||||
ret = eval(pycode_compiled, {}, available_vars)
|
||||
if mode == "eval":
|
||||
ret = "{n<<< %s%s" % (str(ret), duration)
|
||||
ret = "<<< %s%s" % (str(ret), duration)
|
||||
else:
|
||||
ret = "{n<<< Done.%s" % duration
|
||||
ret = "<<< Done (use self.msg() if you want to catch output)%s" % duration
|
||||
except Exception:
|
||||
errlist = traceback.format_exc().split('\n')
|
||||
if len(errlist) > 4:
|
||||
errlist = errlist[4:]
|
||||
ret = "\n".join("{n<<< %s" % line for line in errlist if line)
|
||||
ret = "\n".join("<<< %s" % line for line in errlist if line)
|
||||
|
||||
try:
|
||||
self.msg(ret, sessid=self.sessid)
|
||||
self.msg(ret, sessid=self.sessid, raw=True)
|
||||
except TypeError:
|
||||
self.msg(ret)
|
||||
self.msg(ret, raw=True)
|
||||
|
||||
|
||||
# helper function. Kept outside so it can be imported and run
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue