changeset 0e2333b86562 in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=0e2333b86562
description:
        main: separate out interact() so it can be used by other functions

diffstat:

 src/python/m5/main.py |  18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

diffs (35 lines):

diff -r a1b68c63c754 -r 0e2333b86562 src/python/m5/main.py
--- a/src/python/m5/main.py     Wed Apr 13 09:32:17 2011 -0700
+++ b/src/python/m5/main.py     Wed Apr 13 09:32:18 2011 -0700
@@ -128,6 +128,16 @@
 
 arguments = options.parse_args()
 
+def interact(scope):
+    banner = "M5 Interactive Console"
+    sys.argv = []
+    try:
+        from IPython.Shell import IPShellEmbed
+        ipshell = IPShellEmbed(banner=banner,user_ns=scope)
+        ipshell()
+    except ImportError:
+        code.InteractiveConsole(scope).interact(banner)
+
 def main():
     import core
     import debug
@@ -349,13 +359,7 @@
 
     # once the script is done
     if options.interactive:
-        banner = "M5 Interactive Console"
-        try:
-            from IPython.Shell import IPShellEmbed
-            ipshell = IPShellEmbed(banner=banner,user_ns=scope)
-            ipshell()
-        except ImportError:
-            code.InteractiveConsole(scope).interact(banner)
+        interact(scope)
 
 if __name__ == '__main__':
     from pprint import pprint
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to