##// END OF EJS Templates
dispatch: move initialization of sys.std* files...
Yuya Nishihara -
r34534:163fa0ae default
parent child Browse files
Show More
@@ -94,7 +94,4 b' def runcommand(lui, repo, cmd, fullargs,'
94
94
95 dispatch.runcommand = runcommand
95 dispatch.runcommand = runcommand
96
96
97 for fp in (sys.stdin, sys.stdout, sys.stderr):
98 util.setbinary(fp)
99
100 dispatch.run()
97 dispatch.run()
@@ -37,11 +37,5 b' except ImportError:'
37 sys.stderr.write("(check your install and PYTHONPATH)\n")
37 sys.stderr.write("(check your install and PYTHONPATH)\n")
38 sys.exit(-1)
38 sys.exit(-1)
39
39
40 from mercurial import (
40 from mercurial import dispatch
41 dispatch,
42 util,
43 )
44 for fp in (sys.stdin, sys.stdout, sys.stderr):
45 util.setbinary(fp)
46
47 dispatch.run()
41 dispatch.run()
@@ -75,6 +75,7 b' class request(object):'
75
75
76 def run():
76 def run():
77 "run the command in sys.argv"
77 "run the command in sys.argv"
78 _initstdio()
78 req = request(pycompat.sysargv[1:])
79 req = request(pycompat.sysargv[1:])
79 err = None
80 err = None
80 try:
81 try:
@@ -95,6 +96,10 b' def run():'
95 req.ui.ferr.flush()
96 req.ui.ferr.flush()
96 sys.exit(status & 255)
97 sys.exit(status & 255)
97
98
99 def _initstdio():
100 for fp in (sys.stdin, sys.stdout, sys.stderr):
101 util.setbinary(fp)
102
98 def _getsimilar(symbols, value):
103 def _getsimilar(symbols, value):
99 sim = lambda x: difflib.SequenceMatcher(None, value, x).ratio()
104 sim = lambda x: difflib.SequenceMatcher(None, value, x).ratio()
100 # The cutoff for similarity here is pretty arbitrary. It should
105 # The cutoff for similarity here is pretty arbitrary. It should
General Comments 0
You need to be logged in to leave comments. Login now