##// END OF EJS Templates
use Popen command list for ipexec...
MinRK -
r11475:3541252e
parent child
Show More
@@ -26,6 +26,7 import tempfile
26
26
27 from contextlib import contextmanager
27 from contextlib import contextmanager
28 from io import StringIO
28 from io import StringIO
29 from subprocess import Popen, PIPE
29
30
30 try:
31 try:
31 # These tools are used by parts of the runtime, so we make the nose
32 # These tools are used by parts of the runtime, so we make the nose
@@ -183,21 +184,22 def ipexec(fname, options=None):
183 '--PromptManager.in2_template=""',
184 '--PromptManager.in2_template=""',
184 '--PromptManager.out_template=""'
185 '--PromptManager.out_template=""'
185 ]
186 ]
186 cmdargs = ' '.join(default_argv() + prompt_opts + options)
187 cmdargs = default_argv() + prompt_opts + options
187
188
188 _ip = get_ipython()
189 _ip = get_ipython()
189 test_dir = os.path.dirname(__file__)
190 test_dir = os.path.dirname(__file__)
190
191
191 # FIXME: remove workaround for 2.6 support
192 # FIXME: remove workaround for 2.6 support
192 if sys.version_info[:2] > (2,6):
193 if sys.version_info[:2] > (2,6):
193 ipython_cmd = pipes.quote(sys.executable) + " -m IPython"
194 ipython_cmd = [sys.executable, "-m", "IPython"]
194 else:
195 else:
195 ipython_cmd = "ipython"
196 ipython_cmd = ["ipython"]
196 # Absolute path for filename
197 # Absolute path for filename
197 full_fname = os.path.join(test_dir, fname)
198 full_fname = os.path.join(test_dir, fname)
198 full_cmd = '%s %s %s' % (ipython_cmd, cmdargs, full_fname)
199 full_cmd = ipython_cmd + cmdargs + [full_fname]
199 #print >> sys.stderr, 'FULL CMD:', full_cmd # dbg
200 p = Popen(full_cmd, stdout=PIPE, stderr=PIPE)
200 out, err = getoutputerror(full_cmd)
201 out, err = p.communicate()
202 out, err = py3compat.bytes_to_str(out), py3compat.bytes_to_str(err)
201 # `import readline` causes 'ESC[?1034h' to be output sometimes,
203 # `import readline` causes 'ESC[?1034h' to be output sometimes,
202 # so strip that out before doing comparisons
204 # so strip that out before doing comparisons
203 if out:
205 if out:
General Comments 0
You need to be logged in to leave comments. Login now