Merge branch 'stroucki-releasebugs'
Conflicts:
src/tashi/util.py
git-svn-id: https://svn.apache.org/repos/asf/incubator/tashi/trunk@1298106 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/tashi/util.py b/src/tashi/util.py
index af4fbe5..1d114d5 100644
--- a/src/tashi/util.py
+++ b/src/tashi/util.py
@@ -211,28 +211,32 @@
raise Exception("No config file could be found: %s" % (str(allLocations)))
return (config, configFiles)
-def __getShellFn(globalDict):
+def __getShellFn():
try:
from IPython.Shell import IPShellEmbed
- return IPShellEmbed(user_ns=globalDict)
+ return (1, IPShellEmbed)
except ImportError:
import IPython
- return IPython.embed(user_ns=globalDict)
+ return (2, IPython.embed)
def debugConsole(globalDict):
"""A debugging console that optionally uses pysh"""
def realDebugConsole(globalDict):
try :
import atexit
- shellfn = __getShellFn(globalDict)
+ (calltype, shellfn) = __getShellFn()
def resetConsole():
# XXXpipe: make input window sane
(stdin, stdout) = os.popen2("reset")
stdout.read()
- dbgshell = shellfn()
atexit.register(resetConsole)
- dbgshell()
- except Exception:
+ if calltype == 1:
+ dbgshell=shellfn(user_ns=globalDict)
+ dbgshell()
+ elif calltype == 2:
+ dbgshell=shellfn
+ dbgshell(user_ns=globalDict)
+ except Exception, e:
CONSOLE_TEXT=">>> "
input = " "
while (input != ""):
@@ -242,6 +246,10 @@
exec(input) in globalDict
except Exception, e:
sys.stdout.write(str(e) + "\n")
+
+ import os
+ os._exit(0)
+
if (os.getenv("DEBUG", "0") == "1"):
threading.Thread(target=lambda: realDebugConsole(globalDict)).start()