procutil: split import and reassignment
authorManuel Jacob <me@manueljacob.de>
Sat, 04 Jul 2020 11:21:44 +0200
changeset 45042 c88577199023
parent 45041 1053f878dd46
child 45043 be58fb1eaa73
procutil: split import and reassignment Besides making the code clearer, it will reduce the diff in the next patch.
mercurial/utils/procutil.py
--- a/mercurial/utils/procutil.py	Sat Jul 04 11:15:58 2020 +0200
+++ b/mercurial/utils/procutil.py	Sat Jul 04 11:21:44 2020 +0200
@@ -37,6 +37,11 @@
 
 osutil = policy.importmod('osutil')
 
+if pycompat.iswindows:
+    from .. import windows as platform
+else:
+    from .. import posix as platform
+
 
 def isatty(fp):
     try:
@@ -94,11 +99,8 @@
         stdout = os.fdopen(stdout.fileno(), 'wb', 1)
 
 if pycompat.iswindows:
-    from .. import windows as platform
+    stdout = platform.winstdout(stdout)
 
-    stdout = platform.winstdout(stdout)
-else:
-    from .. import posix as platform
 
 findexe = platform.findexe
 _gethgcmd = platform.gethgcmd