Show More
@@ -110,7 +110,7 b' class ui(object):' | |||||
110 | sys.stdout.write(str(a)) |
|
110 | sys.stdout.write(str(a)) | |
111 |
|
111 | |||
112 | def write_err(self, *args): |
|
112 | def write_err(self, *args): | |
113 | sys.stdout.flush() |
|
113 | if not sys.stdout.closed: sys.stdout.flush() | |
114 | for a in args: |
|
114 | for a in args: | |
115 | sys.stderr.write(str(a)) |
|
115 | sys.stderr.write(str(a)) | |
116 |
|
116 |
@@ -13,7 +13,8 b' platform-specific details from the core.' | |||||
13 | import os, errno |
|
13 | import os, errno | |
14 | from i18n import gettext as _ |
|
14 | from i18n import gettext as _ | |
15 | from demandload import * |
|
15 | from demandload import * | |
16 |
demandload(globals(), " |
|
16 | demandload(globals(), "cStringIO errno popen2 re shutil sys tempfile") | |
|
17 | demandload(globals(), "threading time") | |||
17 |
|
18 | |||
18 | def pipefilter(s, cmd): |
|
19 | def pipefilter(s, cmd): | |
19 | '''filter string S through command CMD, returning its output''' |
|
20 | '''filter string S through command CMD, returning its output''' | |
@@ -442,12 +443,36 b' else:' | |||||
442 | if os.name == 'nt': |
|
443 | if os.name == 'nt': | |
443 | demandload(globals(), "msvcrt") |
|
444 | demandload(globals(), "msvcrt") | |
444 | nulldev = 'NUL:' |
|
445 | nulldev = 'NUL:' | |
445 |
|
446 | |||
|
447 | class winstdout: | |||
|
448 | '''stdout on windows misbehaves if sent through a pipe''' | |||
|
449 | ||||
|
450 | def __init__(self, fp): | |||
|
451 | self.fp = fp | |||
|
452 | ||||
|
453 | def __getattr__(self, key): | |||
|
454 | return getattr(self.fp, key) | |||
|
455 | ||||
|
456 | def close(self): | |||
|
457 | try: | |||
|
458 | self.fp.close() | |||
|
459 | except: pass | |||
|
460 | ||||
|
461 | def write(self, s): | |||
|
462 | try: | |||
|
463 | return self.fp.write(s) | |||
|
464 | except IOError, inst: | |||
|
465 | if inst.errno != 0: raise | |||
|
466 | self.close() | |||
|
467 | raise IOError(errno.EPIPE, 'Broken pipe') | |||
|
468 | ||||
|
469 | sys.stdout = winstdout(sys.stdout) | |||
|
470 | ||||
446 | try: |
|
471 | try: | |
447 | import win32api, win32process |
|
472 | import win32api, win32process | |
448 | filename = win32process.GetModuleFileNameEx(win32api.GetCurrentProcess(), 0) |
|
473 | filename = win32process.GetModuleFileNameEx(win32api.GetCurrentProcess(), 0) | |
449 | systemrc = os.path.join(os.path.dirname(filename), 'mercurial.ini') |
|
474 | systemrc = os.path.join(os.path.dirname(filename), 'mercurial.ini') | |
450 |
|
475 | |||
451 | except ImportError: |
|
476 | except ImportError: | |
452 | systemrc = r'c:\mercurial\mercurial.ini' |
|
477 | systemrc = r'c:\mercurial\mercurial.ini' | |
453 | pass |
|
478 | pass |
General Comments 0
You need to be logged in to leave comments.
Login now