diff options
author | Greg Hudson <ghudson@mit.edu> | 2016-05-02 12:51:03 -0400 |
---|---|---|
committer | Greg Hudson <ghudson@mit.edu> | 2016-05-03 13:25:18 -0400 |
commit | 0f35ac91b7755d60e97d95ff41725c21dbce5f55 (patch) | |
tree | 5363b04b56c4282b142f3c116043b1ce70ecff3b /src/util | |
parent | d749bfafd93c3acaaa6159ce4600be95e968503e (diff) | |
download | krb5-0f35ac91b7755d60e97d95ff41725c21dbce5f55.zip krb5-0f35ac91b7755d60e97d95ff41725c21dbce5f55.tar.gz krb5-0f35ac91b7755d60e97d95ff41725c21dbce5f55.tar.bz2 |
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.
Diffstat (limited to 'src/util')
-rw-r--r-- | 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() |