changeset 41388:fabb0224a599

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
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 17 Jan 2019 09:24:30 -0800
parents 876494fd967d
children b44f1703b28c
files tests/hghave.py
diffstat 1 files changed, 2 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- 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)