changeset 45045:c88577199023

procutil: split import and reassignment Besides making the code clearer, it will reduce the diff in the next patch.
author Manuel Jacob <me@manueljacob.de>
date Sat, 04 Jul 2020 11:21:44 +0200
parents 1053f878dd46
children be58fb1eaa73
files mercurial/utils/procutil.py
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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