hghave: let OSError with ENOENT through like any other
authorMartin von Zweigbergk <martinvonz@google.com>
Thu, 17 Jan 2019 09:24:30 -0800
changeset 41366 fabb0224a599
parent 41365 876494fd967d
child 41367 b44f1703b28c
hghave: let OSError with ENOENT through like any other Before this patch, if we get an OSError with ENOENT, we would not re-raise it and would instead run into an undefined variable ("p") soon thereafter. Differential Revision: https://phab.mercurial-scm.org/D5631
tests/hghave.py
--- a/tests/hghave.py	Thu Jan 17 09:17:12 2019 -0800
+++ b/tests/hghave.py	Thu Jan 17 09:24:30 2019 -0800
@@ -1,6 +1,5 @@
 from __future__ import absolute_import
 
-import errno
 import os
 import re
 import socket
@@ -118,13 +117,8 @@
     is matched by the supplied regular expression.
     """
     r = re.compile(regexp)
-    try:
-        p = subprocess.Popen(
-            cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
-    except OSError as e:
-        if e.errno != errno.ENOENT:
-            raise
-        ret = -1
+    p = subprocess.Popen(
+        cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
     s = p.communicate()[0]
     ret = p.returncode
     return (ignorestatus or not ret) and r.search(s)