Patchwork [6,of,8] py3: un-byteify strings around os.system() and os.devnull in contrib/perf

login
register
mail settings
Submitter Matt Harbison
Date Sept. 22, 2018, 3:28 p.m.
Message ID <716b949d413e7f714f9f.1537630122@Envy>
Download mbox | patch
Permalink /patch/34920/
State Accepted
Headers show

Comments

Matt Harbison - Sept. 22, 2018, 3:28 p.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1537576080 14400
#      Fri Sep 21 20:28:00 2018 -0400
# Node ID 716b949d413e7f714f9f5f3595ee462f0a3bb928
# Parent  eee31df781ee594ac9fa82e34014790792c927c1
py3: un-byteify strings around os.system() and os.devnull in contrib/perf

Patch

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -910,11 +910,11 @@  def perfstartup(ui, repo, **opts):
     timer, fm = gettimer(ui, opts)
     cmd = sys.argv[0]
     def d():
-        if os.name != b'nt':
+        if pycompat.osname != b'nt':
             os.system(b"HGRCPATH= %s version -q > /dev/null" % cmd)
         else:
-            os.environ[b'HGRCPATH'] = b' '
-            os.system(b"%s version -q > NUL" % cmd)
+            os.environ[r'HGRCPATH'] = r' '
+            os.system(r"%s version -q > NUL" % cmd)
     timer(d)
     fm.end()
 
@@ -1048,7 +1048,7 @@  def perftemplating(ui, repo, testedtempl
                           hint=b"use 4.3 or later")
 
     nullui = ui.copy()
-    nullui.fout = open(os.devnull, b'wb')
+    nullui.fout = open(os.devnull, r'wb')
     nullui.disablepager()
     revs = opts.get(b'rev')
     if not revs: