Show More
@@ -20,6 +20,11 from prompt_toolkit import __version__ as ptk_version | |||||
20 | PTK3 = ptk_version.startswith('3.') |
|
20 | PTK3 = ptk_version.startswith('3.') | |
21 |
|
21 | |||
22 |
|
22 | |||
|
23 | # we want to avoid ptk as much as possible when using subprocesses | |||
|
24 | # as it uses cursor positioning requests, deletes color .... | |||
|
25 | _use_simple_prompt = "IPY_TEST_SIMPLE_PROMPT" in os.environ | |||
|
26 | ||||
|
27 | ||||
23 | class TerminalPdb(Pdb): |
|
28 | class TerminalPdb(Pdb): | |
24 | """Standalone IPython debugger.""" |
|
29 | """Standalone IPython debugger.""" | |
25 |
|
30 | |||
@@ -87,8 +92,9 class TerminalPdb(Pdb): | |||||
87 | if not PTK3: |
|
92 | if not PTK3: | |
88 | options['inputhook'] = self.shell.inputhook |
|
93 | options['inputhook'] = self.shell.inputhook | |
89 | options.update(pt_session_options) |
|
94 | options.update(pt_session_options) | |
90 | self.pt_loop = asyncio.new_event_loop() |
|
95 | if not _use_simple_prompt: | |
91 | self.pt_app = PromptSession(**options) |
|
96 | self.pt_loop = asyncio.new_event_loop() | |
|
97 | self.pt_app = PromptSession(**options) | |||
92 |
|
98 | |||
93 | def cmdloop(self, intro=None): |
|
99 | def cmdloop(self, intro=None): | |
94 | """Repeatedly issue a prompt, accept input, parse an initial prefix |
|
100 | """Repeatedly issue a prompt, accept input, parse an initial prefix | |
@@ -121,10 +127,15 class TerminalPdb(Pdb): | |||||
121 | self._ptcomp.ipy_completer.global_namespace = self.curframe.f_globals |
|
127 | self._ptcomp.ipy_completer.global_namespace = self.curframe.f_globals | |
122 |
|
128 | |||
123 | # Run the prompt in a different thread. |
|
129 | # Run the prompt in a different thread. | |
124 |
|
|
130 | if not _use_simple_prompt: | |
125 | line = self.thread_executor.submit(self.pt_app.prompt).result() |
|
131 | try: | |
126 | except EOFError: |
|
132 | line = self.thread_executor.submit( | |
127 | line = "EOF" |
|
133 | self.pt_app.prompt | |
|
134 | ).result() | |||
|
135 | except EOFError: | |||
|
136 | line = "EOF" | |||
|
137 | else: | |||
|
138 | line = input("ipdb> ") | |||
128 |
|
139 | |||
129 | line = self.precmd(line) |
|
140 | line = self.precmd(line) | |
130 | stop = self.onecmd(line) |
|
141 | stop = self.onecmd(line) |
General Comments 0
You need to be logged in to leave comments.
Login now