diff options
author | Nathan Binkert <nate@binkert.org> | 2011-04-13 09:32:18 -0700 |
---|---|---|
committer | Nathan Binkert <nate@binkert.org> | 2011-04-13 09:32:18 -0700 |
commit | 9d94d48a7d94ea0e18e35d5974ea70bb641e7640 (patch) | |
tree | 3699b63364e6570fc821e9ee75bd799d13bc3299 /src/python | |
parent | 326adda5f39d7aa90c573ad3444d27a3defbd1bc (diff) | |
download | gem5-9d94d48a7d94ea0e18e35d5974ea70bb641e7640.tar.xz |
main: separate out interact() so it can be used by other functions
Diffstat (limited to 'src/python')
-rw-r--r-- | src/python/m5/main.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/python/m5/main.py b/src/python/m5/main.py index dc8aab924..f932ec63a 100644 --- a/src/python/m5/main.py +++ b/src/python/m5/main.py @@ -128,6 +128,16 @@ if options_file: 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 @@ def main(): # 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 |