diff options
author | C Nelson <cnelsonsic@gmail.com> | 2012-04-06 13:12:30 -0500 |
---|---|---|
committer | C Nelson <cnelsonsic@gmail.com> | 2012-04-06 13:12:30 -0500 |
commit | 84fc578838bdf1a4f3f51b5ec6a6b758acf69507 (patch) | |
tree | c1f1af74f68b671ecc32bf2bbdc32f1e02898f05 | |
parent | 015d676f5a275261858bafd3d60ba180323403b6 (diff) |
Making generate_diff_insert python2.7 compatible.
original-commit-id: bd06a22fb874dcc2a51255670656afec6f5e21ea
-rw-r--r-- | crystal.py | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -5836,13 +5836,16 @@ def generate_diff_insert(line_number, newline, debug=False): newfile_fh.close() try: + from subprocess import CalledProcessError + except ImportError: + CalledProcessError = None + + try: diffcontent = subprocess.check_output("diff -u ../main.asm " + newfile_filename, shell=True) - except AttributeError, exc: + except (AttributeError, CalledProcessError): p = subprocess.Popen(["diff", "-u", "../main.asm", newfile_filename], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = p.communicate() diffcontent = out - except Exception, exc: - raise exc os.system("rm " + original_filename) os.system("rm " + newfile_filename) |