# HG changeset patch
# User Willem Jan Palenstijn <wjp@usecode.org>
# Date 1263754092 28800
# Node ID 06cb5f58b70b8d9f0c5d0fb6be7e52cd475812b9
# Parent 5ea2ef57e731acc62b1727a3ea4e55a567b3f920
#7967: replace os.popen3 by subprocess.Popen
diff -r 5ea2ef57e731 -r 06cb5f58b70b sage/misc/hg.py
a
|
b
|
|
43 | 43 | from misc import tmp_filename, branch_current_hg, embedded |
44 | 44 | from remote_file import get_remote_file as get_remote_file0 |
45 | 45 | from sage.server.misc import print_open_msg |
| 46 | from subprocess import Popen |
46 | 47 | import re |
47 | 48 | |
48 | 49 | sage_trac_re = re.compile('http[s]?://(sagetrac\.org|trac\.sagemath\.org)/sage_trac/attachment/ticket/[0-9]+/.*\.(patch|hg)') |
… |
… |
|
213 | 214 | |
214 | 215 | - ``interactive`` - If True, runs using os.system, so |
215 | 216 | user can interactively interact with hg, i.e., this is needed when |
216 | | you record changes because the editor pops up. If False, popen3 is |
| 217 | you record changes because the editor pops up. If False, Popen is |
217 | 218 | used to launch hg as a subprocess. |
218 | 219 | |
219 | 220 | |
… |
… |
|
237 | 238 | e = os.system(s) |
238 | 239 | return e |
239 | 240 | else: |
240 | | x = os.popen3(s) |
241 | | x[0].close() |
242 | | out = x[1].read() |
243 | | err = x[2].read() |
| 241 | from subprocess import PIPE |
| 242 | x = Popen(s, shell=True, |
| 243 | stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True) |
| 244 | x.stdin.close() |
| 245 | out = x.stdout.read() |
| 246 | err = x.stderr.read() |
244 | 247 | return out, err |
245 | 248 | |
246 | 249 | def serve(self, port=8200, address='localhost', |