[29407] in CVS-changelog-for-Kerberos-V5

home help back first fref pref prev next nref lref last post

krb5 commit: Fix cstyle-file.py when emacs is not installed

daemon@ATHENA.MIT.EDU (Greg Hudson)
Tue May 3 13:39:00 2016

Date: Tue, 3 May 2016 13:38:55 -0400
From: Greg Hudson <ghudson@mit.edu>
Message-Id: <201605031738.u43HctGC003775@drugstore.mit.edu>
To: cvs-krb5@mit.edu
Reply-To: krbdev@mit.edu
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cvs-krb5-bounces@mit.edu

https://github.com/krb5/krb5/commit/0f35ac91b7755d60e97d95ff41725c21dbce5f55
commit 0f35ac91b7755d60e97d95ff41725c21dbce5f55
Author: Greg Hudson <ghudson@mit.edu>
Date:   Mon May 2 12:51:03 2016 -0400

    Fix cstyle-file.py when emacs is not installed
    
    emacs_reindent() is intended to fail gracefully when emacs is not
    installed, but instead subprocess.call() throws an OSError.  Check for
    this error and return normally.

 src/util/cstyle-file.py |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/src/util/cstyle-file.py b/src/util/cstyle-file.py
index a080fef..7e90b66 100644
--- a/src/util/cstyle-file.py
+++ b/src/util/cstyle-file.py
@@ -76,7 +76,12 @@ def emacs_reindent(lines):
         args = ['emacs', '-q', '-batch', '-l', cstyle_el, '-l', reindent_el,
                 f.name]
         with open(os.devnull, 'w') as devnull:
-            if call(args, stdin=devnull, stdout=devnull, stderr=devnull) != 0:
+            try:
+                st = call(args, stdin=devnull, stdout=devnull, stderr=devnull)
+                if st != 0:
+                    return None
+            except OSError:
+                # Fail gracefully if emacs isn't installed.
                 return None
         f.seek(0)
         ilines = f.readlines()
_______________________________________________
cvs-krb5 mailing list
cvs-krb5@mit.edu
https://mailman.mit.edu/mailman/listinfo/cvs-krb5

home help back first fref pref prev next nref lref last post