Show More
@@ -29,6 +29,7 b' from __future__ import print_function' | |||
|
29 | 29 | |
|
30 | 30 | import os |
|
31 | 31 | import re |
|
32 | import subprocess | |
|
32 | 33 | import sys |
|
33 | 34 | import tempfile |
|
34 | 35 | |
@@ -41,6 +42,7 b' from IPython.utils.data import chop' | |||
|
41 | 42 | from IPython.utils import io |
|
42 | 43 | from IPython.utils.process import system |
|
43 | 44 | from IPython.utils.terminal import get_terminal_size |
|
45 | from IPython.utils import py3compat | |
|
44 | 46 | |
|
45 | 47 | |
|
46 | 48 | #----------------------------------------------------------------------------- |
@@ -219,9 +221,12 b' def page(strng, start=0, screen_lines=0, pager_cmd=None):' | |||
|
219 | 221 | # if I use popen4, things hang. No idea why. |
|
220 | 222 | #pager,shell_out = os.popen4(pager_cmd) |
|
221 | 223 | pager = os.popen(pager_cmd,'w') |
|
222 |
|
|
|
223 | pager.close() | |
|
224 | retval = pager.close() # success returns None | |
|
224 | try: | |
|
225 | pager_encoding = pager.encoding or sys.stdout.encoding | |
|
226 | pager.write(py3compat.cast_bytes_py2( | |
|
227 | strng, encoding=pager_encoding)) | |
|
228 | finally: | |
|
229 | retval = pager.close() | |
|
225 | 230 | except IOError as msg: # broken pipe when user quits |
|
226 | 231 | if msg.args == (32,'Broken pipe'): |
|
227 | 232 | retval = None |
@@ -338,4 +343,3 b" def snip_print(str,width = 75,print_full = 0,header = ''):" | |||
|
338 | 343 | if raw_input(header+' Snipped. View (y/n)? [N]').lower() == 'y': |
|
339 | 344 | page(str) |
|
340 | 345 | return snip |
|
341 |
General Comments 0
You need to be logged in to leave comments.
Login now